...

.htaccess : Hiding .php extensions in URL

cancer10
07-17-2011, 05:10 AM
Hi

I was wondering if there is anyway we can hide the .php extension in the URL using .htaccess?

For example

These URLs:
http://example.com/home.php
http://example.com/welcome/contact-us.php
http://example.com/home/support/email_us.php


Should look like
http://example.com/home
http://example.com/welcome/contact-us
http://example.com/home/support/email_us


Pls let me know if this is possible and how?


Many thanks

dhape
09-21-2011, 12:20 AM
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php


With this rewrite, http://www.example.com/home.php is the same as http://www.example.com/home

cancer10
09-21-2011, 03:02 AM
Thanks very much

Jinxy
09-23-2011, 01:08 AM
This should do it for all extensions:

Options +MultiViews



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum