Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want http://www.foo.com/ to internally point to /var/www/home.php and http://www.foo.com/home.php to be redirected to http://www.foo.com/.

Thus, I would like to fix the old http://www.foo.com/home.php to the new one http://www.foo.com/. But I always get infinite loop or other strange error no matter what.

share|improve this question

migrated from serverfault.com Feb 21 '11 at 21:40

This question came from our site for system and network administrators.

What rule are you trying, so we can tell you what's wrong with it. – DerfK Feb 20 '11 at 18:42

If you will redirect from foo.com to home.php then it would ofcourse go in to infinite loop. Rather try to include the home.php page in the index page of foo.com/

share|improve this answer

If you just want home.php to be the directory index (as opposed to the usual index.php, etc), you don't need the overhead of mod_rewrite to do it:

DirectoryIndex home.php index.php index.html // and so on

It works in directory .htaccess files too, if you want to maintain a different default elsewhere. More details via mod_dir.

share|improve this answer

In your virtualhost definition for foo.com:

DocumentRoot /var/www/

Then your rewrite rule:

RewriteRule ^/home.php$ /
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.