I am using Wolf CMS, which is served by PHP.
I want to redirect /index.html to /index.php.
I put the following in .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} ^index.html$ [NC]
RewriteRule ^index.html$ index.php [R=301,L]
# Wolf CMS rewriting
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ index.php?WOLFPAGE=$1 [L,QSA]
</IfModule>
This works in that index.html is rewritten as index.php, but then index.php is rewritten as index.php?WOLFPAGE=index.html, which should not occur as the WOLFPAGE rule has a condition that it should only apply if the file does not exist, as indicated by the !-f rewrite condition.
index.php does exist, so why is it being rewritten? Why is the condition being violated?
Update - the server version is:
- Server: Apache/2.2.17 (Unix)
- mod_ssl/2.2.17
- OpenSSL/0.9.8e-fips-rhel5
- mod_bwlimited/1.4
- mod_perl/2.0.4
- Perl/v5.8.8
- X-Powered-By: PHP/5.2.16
Update2 - I have since moved the site from /test to /, and the problem is not occurring any more. Looking at .htaccess above, I had the incorrect rewrite base; hence the server could not find index.php, which matched the conditions for the WOLFPAGE rewrite.