Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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
    
What rule are you trying, so we can tell you what's wrong with it. –  DerfK Feb 20 '11 at 18:42
add comment

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

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

3 Answers

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
add comment

In your virtualhost definition for foo.com:

DocumentRoot /var/www/

Then your rewrite rule:

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

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
add comment

Your Answer

 
discard

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