How to rewrite index.php (and other valid default files) to the document root using mod_rewrite?
Posted
by TMG
on Server Fault
See other posts from Server Fault
or by TMG
Published on 2010-04-21T18:07:36Z
Indexed on
2010/04/21
18:13 UTC
Read the original article
Hit count: 205
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!
© Server Fault or respective owner