I\'m trying to redirect index.php files to the root /, I\'ve searched around and found several snippets of code similar to:
RewriteCond %{THE_REQUEST} ^.*/in
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.
Can be use this
RewriteRule ^index\.php/(.*)$ http://www.example.com/$1 [R=301,L]
Do this:
RewriteCond %{THE_REQUEST} ^.*/index\.php
RewriteRule ^(.*)index.php$ /$1 [R=301,L]