: Beginner's Apache mod_rewrite - use custom file for website root Plain and simple - I want user to get main.php file instead of index.php, when he enters website. Such a straightforward task
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 ^/$ 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.
More posts by @Twilah146
2 Comments
Sorted by latest first Latest Oldest Best
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.
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.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.