Inspired by my discussion with Kaspars on his homepage konstruktors.com how to better remove index file. So I’ll post both versions, because they use different methods: with and with out RewriteEngine On.
Here is mine with RewriteEngine On (works on this hosting and both versions of GoDaddy hosting plans example1.com and example1.com/example2.com):
# This will remove index.html AND index.php from URL
RewriteCond %{THE_REQUEST} \/index\.(php|html)\ HTTP [NC]
RewriteRule (.*)index\.(php|html)$ /$1 [R=301,L]
And Kaspar’s method without RewriteEngine On:
RewriteEngine On # remove this, if you have it already
RewriteCond %{REQUEST_URI} index\.html
RewriteRule ^(.*)index\.html$ /$1/ [R=301,L]
Purpose of this is to remove duplicate content from Internet.
[Update on 2010.03.30]
Please keep in mind that some web applications still need index.php file for installation scripts as referrers. So it’s good to keep it in mind and comment these line during installation process if it fails.
# This will remove index.html AND index.php from URL
# RewriteCond %{THE_REQUEST} \/index\.(php|html)\ HTTP [NC]
# RewriteRule (.*)index\.(php|html)$ /$1 [R=301,L]














