g1smd - 6:26 am on Oct 3, 2012 (gmt 0)
Your code now redirects requests for
example.com/ and requests for
If you also have a non-www to www rule in your htaccess file, a request for
example.com/index.html is redirected twice before eventually reaching
www.example.com/ - use the Live HTTP Headers extension for Firefox to confirm this.
This unwanted redirection chain will cause issues.
You should add the canonical protocol and hostname to the rule above and make sure that the index redirect is listed before the non-www/www redirect in the htaccess file.
You should also escape all literal periods in patterns.
If your site actually uses an index.html or index.htm file to serve content you probably can't view the content now and get an error message instead. You will need to add a preceding
RewriteCond looking at
THE_REQUEST to ensure that only external requests for the index file are redirected, not requests for the index file that happen as a result of the final internal rewrite to fetch the content.
Finally, why redirect only root requests? Using
^(([^/]+/)*)index\.html?$ will enable this redirect for all folder levels.
Example code for this appears in thousands of previous threads. Note: If there is a (.*) pattern in the index rule then it is the wrong code.