Author: Sally
Date: 15-04-03 10:27
I've tried implementing a variety of solutions to rewrite .htm requests to .php files and serve the original .htm if a .php file isn't there.
I got the suggestion from this site to work fine in an .htaccess file (although could not get it to work in my Virtual Hosts config):
RewriteEngine on
RewriteBase /
RewriteRule ^(.*)\.htm$ $1 [C,E=WasHTM:yes]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [S=1,R=permanent]
RewriteCond %{ENV:WasHTM} ^yes$
RewriteRule ^(.*)$ $1.htm
the problem is, that if someone reuqests an index.htm file somewhere on the site where there is neither an index.htm or an index.php, the server shows a 403 Forbidden error rather then a 404 File not Found. This is definitely caused by this rewrite as without it I get 404s. How can I stop this from happening??
Sally.
|
|