Hello all,
I'm trying to remove the extensions of all the pages in a web site I'm working.
I've written this into the .htaccess file:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /base/404.php [L]
RewriteRule ^(.+[^/])/$ http://%{HTTP_HOST}/$1 [R=301,L]
#from http://whatever.com to http://www.whatever.com
RewriteCond %{HTTP_HOST} ^whatever.com$
RewriteRule ^/?$ "http\:\/\/www\.whatever\.com\/" [R=301,L]
#Try to remove the php extensions
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ /$1.php [L]
The first part of the code works, but when I try to remove the php extensions it doesn't.
I would like to remove the extension from the filename it's shown in the browser... supposedly it makes it more difficult to get hacked, but the truly important reason is that it seems that it is a good thing for the seo of the page...
Is there any way to get this done?
I've tried some internet examples but I can't get it to work.
Any hint?
Thank you!
What I have tried:
Using various snippets that I've found in the Internet but that have not worked...