I’m using htaccess below to remove .php from URL but it won’t work.
http://www.me.com/index.php should read http://www.me.com/index
Any reason why?
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
I looked at these examples too but no luck:
I think your missing the point – it doesnt change/rewrite the URL – it adds
.phpto the URL you request, so when you requesthttp://www.example.com/indexit checks the requested filename is not a directory (!-d) and then checks a valid PHP file exists (-f). Then rewrites the request (not the URL) to request theindex.phpfile.From the documentation for
mod_rewritethis is the description