1

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.

2
  • 1
    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
0

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.

0

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.

1
  • Of course it's on.
    – Nordvind
    Dec 26 '11 at 16:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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