开发者

mod_rewrite: Rewrite root to somewhere else [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 12 years ago.

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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜