I've got Apache 2.4.4 running on Windows 8 laptop (WAMP server) and I found a really odd behavior of .htaccess mod_rewrite rules.
I want to redirect the root of my website to a specific file. My .htaccess looks like this:
RewriteEngine On
RewriteBase /
RewriteRule $^ /static/home.php
This works only if there's no index.php file in root directory. When I create index.php file, Apache redirects empty path straight to the index file and doesn't bother with the aformentioned RewriteRule.
Is there a way to have both this RewriteRule and index.php file working together?
Ans )) You can just tweak your regex pattern to work in both situation:
RewriteEngine On
RewriteRule ^(index\.php)?$ /static/home.php [L]
This will route both
domain.com/ and domain/com/index.php to static page.
No comments:
Post a Comment