How to hide .php extension
Posted: Tue Apr 27, 2010 9:03 pm
Hello Everyone,
I am attempting to hide the .php extension on my website so that link to my pages will not look like this ( .../pages/test.php) but rather look like this ( .../pages/test/ ) .
I have been google searching for answers and received a bunch of articles but none of the methods discussed seem to work for me... I contacted my host provider which happens to be 1and1.com and was informed the server is running Apache, so I have attempted to use .htaccess file with the following code :
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/robots\.txt$ [NC]
RewriteCond %{HTTP_HOST} !^www\.[a-z-]+\.[a-z]{2,6} [NC]
RewriteCond %{HTTP_HOST} ([a-z-]+\.[a-z]{2,6})$ [NC]
RewriteRule ^/(.*)$ http://%1/$1 [R=301,L]
ServerSignature Off
but it is not working properly.. can someone point me in the right direction... maybe I need additional files to make above work? Please help
Thank You
I am attempting to hide the .php extension on my website so that link to my pages will not look like this ( .../pages/test.php) but rather look like this ( .../pages/test/ ) .
I have been google searching for answers and received a bunch of articles but none of the methods discussed seem to work for me... I contacted my host provider which happens to be 1and1.com and was informed the server is running Apache, so I have attempted to use .htaccess file with the following code :
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/robots\.txt$ [NC]
RewriteCond %{HTTP_HOST} !^www\.[a-z-]+\.[a-z]{2,6} [NC]
RewriteCond %{HTTP_HOST} ([a-z-]+\.[a-z]{2,6})$ [NC]
RewriteRule ^/(.*)$ http://%1/$1 [R=301,L]
ServerSignature Off
but it is not working properly.. can someone point me in the right direction... maybe I need additional files to make above work? Please help
Thank You