On my website, I want to access PHP resources without having to supply the .php
extension, so in .htaccess
, I say
RewriteEngine on
# If applicable, append ‘.php’
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [L]
This works. I say mysite.com/index
, and index.php
is served.
So far, so good.
But now, when I say mysite.com/index/a
, I get an internal server error. Why is that? This is only after I have moved to a new web host.
I am not familiar with mod_rewrite; I simply copied the above lines somewhere from Stack Overflow. What might be wrong with them?