htaccess redirect index.php to root (including subdomains)
Solution 1:
Do this:
RewriteCond %{THE_REQUEST} ^.*/index\.php
RewriteRule ^(.*)index.php$ /$1 [R=301,L]
Solution 2:
I based the following code on @ThinkingMonkey's answer
RewriteRule ^(.*)index\.(php|html?)$ /$1 [R=301,NC,L]
It redirects URIs ending with index.php, index.htm or index.html to /. Works with subdirectories, too.
Also, notice the NC
flag. It makes it case-insensitive. So it works even if the URI is in upper-case such as INDEX.PHP.