mod_rewrite: Rewrite root to somewhere else [closed]
I'm trying to rewrite URLs to a generic show_page.php script, but I'm having trouble redirecting the root URL. I've been searching Google and stackoverflow but all I've come across implies that ^$ will redirect the root, but for some reason it doesn't. All I get is a 403 Forbidden (since I have indexes turned off).
Here's my current .htaccess:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.+) /show_page.php?url=$1 [QSA,NS]
Other URLs redirect perfectly, and if I change the rule to:
RewriteRule ^$ /show_page.php?开发者_Go百科url=/ [QSA,NS]
I still get the 403.
Sorry, I've just realised my mistake, the rewrite conditions were stopping it from working, doh!
精彩评论