Some servers seem to automatically append index.html
to all HTTP requests, which you can remove by placing this at the beginning of .htaccess
:
RewriteEngine On # remove this, if you have it already RewriteCond %{REQUEST_URI} index\.html RewriteRule ^(.*)index\.html$ /$1/ [R=301,L]
I used this technique for a site that I built — ichomesforsale.com which is hosted at Godaddy.
RewriteCond %{THE_REQUEST} \/index.html\ HTTP [NC]
RewriteRule (.*)index.html$ /$1 [R=301,L]
works with
RewriteEngine On
Somehow Your version on my GoDaddy hosting caused Error 500 :|
This was fast work-around
rolandinsh, I think this
(.*)index.html$
should cause an error because there is an unescaped.
inindex.html
.Kaspars, If about my version, that is just fast-typing typo :) (thanks for cleaning) My mistake! Of course need to escape dots
OK, by cleaning-up made small “upgrade” too:
for both .html and .php :)
RewriteCond %{THE_REQUEST} \/index\.(php|html)\ HTTP [NC]
RewriteRule (.*)index\.(php|html)$ /$1 [R=301,L]
rolandinsh, this looks good.