Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

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

Plain and simple - I want user to get main.php file instead of index.php, when he enters website. Such a straightforward task has caused me a lot of pain, and couple of hours googling. Following does not work:

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^/$ /subdomain/main.php

This doesn't work either:

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^/$ http://localhost/subdomain/main.php

Where is the problem?

P.S. The rules are placed in .htaccess in /subdomain directory. I'm using WAMP, if it matters.

P.P.S. Logs show "File not found" message.

share|improve this question
Is there a reason you are not using Apache's DirectoryIndex directive to accomplish this task? – danlefree Dec 26 '11 at 23:53
No, just wasn't aware of it. Thanks, this should work. – Nordvind Dec 27 '11 at 11:18
up vote 0 down vote accepted

If you want to match URIs in the root directory, your .htaccess file has to be in the root directory, not in /subdirectory.

I agree that the best way to do this would be using the DirectoryIndex directive.

share|improve this answer

Is mod_rewrite enabled in the first place? Unless something's changed since the last time I used Wampserver, it's off by default.

Click the WampServer icon in the system tray, mouse over Apache, then Apache modules. Find rewrite_module(or mod_rewrite) in the menu and click it. Then you'll need to restart all services.

share|improve this answer
Of course it's on. – Nordvind Dec 26 '11 at 16:28

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.