views:

28

answers:

1

Assuming I have the following file structure:

www.example.com/index.php (home page) www.example.com/about.php www.example.com/services.php www.example.com/contact.php

How can I use mod_rewrite in an .htaccess file so when the browser points to: www.example.com/about.php

the actual URL displayed will be: www.example.com/about/

However, I do not want this to apply to index.php In other words, I do not want to see: www.example.com/index/

Thanks for any help as I am about to go bat s**t insane trying to figure this out.... :D

+3  A: 
RewriteCond %{REQUEST_FILENAME} !index.php$
RewriteRule ^(.*)\/$ $1.php [L]

edit: i guess this is better

Devrim
I like it, but why the `([0-9]+)-` at the beginning of the match? Also, shouldn't the `RewriteCond` also have an anchor to avoid matching `/about/index.php`?
pjmorse
@pjmorse: good catch ) i think he'll figure out the rest..
Devrim