Htaccess problem (need your advise for my small problem)

Dear all,

i want to make my links appears without extensions (www.example.com/about) instead of (www.example.com/about.php)
i used this code and it works fine

RewriteEngine on

RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

1- but my problem is that i have a folder name contact and a file with the same name (contact.php)

when i click on the link www.example.com/contact it opens the folder not the html file

notice that my website is dynamic and i can not add static links on htaccess files… i just want to check if there is a folder with the same name just open the original php file not the folder.

2- also for index.php page on my wampserver when i clicked on this link ( http://localhost/[B]trial/[/B]index)
it goes to http://localhost/index/ which is an error… i want to go to the direct link without removing /trial/

Just move contact.php to your root folder.

it is in the root folder but in the root also i have a folder named ‘contact’ i want when i click on contact menu to go to contact.php not contact folder

Ah, I see. Perhaps rename the folder then—if you need it at all. What is it used for?

no i can not rename the folder or the file coz i have many functions to do, it must be the same…

please advice

jz,

My ranting about the :kaioken: EVERYTHING :kaioken: atom hasn’t resonated with you yet? What happens when a hacker believes that you’re using (.*) for your redirection? They will request the server’s password file then something else with a php file extension BECAUSE you didn’t restrict your accepted characters. Please use GOOD, tight regex to prevent problems!

BTW, the problem you’re having is that you’ve enabled Options MultiViews causing Apache to fetch the contact.php file when the directory is requested.

Regards,

DK