1

I am simply trying to redirect /?area=0 link to / .. hostname can be anything. I have tried:

redirectMatch 301 /?area=0 /index.php
RewriteRule ^/?area=0$ /index.php$1 [R=301,L]

Also tried with some little variations, but doesn't redirect or causes internal server error. Redirection only must happen when area is 0 and url does not contain other parameters.

4

1 回答 1

1

通过启用 mod_rewrite 和 .htaccess httpd.conf,然后将此代码放在您.htaccessDOCUMENT_ROOT目录下:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{QUERY_STRING} ^area=0(&|$) [NC]
RewriteRule ^$ /index.php? [L,R=302]

确认它工作正常后,替换R=302R=301. R=301在测试你的 mod_rewrite 规则时避免使用(永久重定向)。

于 2013-05-17T11:40:42.853 回答