How to rewrite index.php (and other valid default files) to the document root using mod_rewrite?
- by TMG
Hello,
I would like to redirect index.php, as well as any other valid default file (e.g. index.html, index.asp, etc.) to the document root (which contains index.php) with something like this:
RewriteRule ^index\.(php|htm|html|asp|cfm|shtml|shtm)/?$ / [NC,L]
However, this is of course giving me an infinite redirect loop. What's the right way to do this?
If possible, I'd like to have this work in both the development and production environment, so I don't want to specify an explicit url like http://www.mysite.com/ as the target.
Thanks!