1

使用文件 .htaccess,我正在尝试像这样重定向 url:

http://www.mysite.com/a-page/?fp=123&sp=456&tp=789

到:

http://www.mysite.com/a-page/

所以基本上将不关心参数值的url重定向到没有任何参数的相同url。

我使用过 RewriteCond/RewriteRule、Redirect 和 RedirectMatch,但没有任何运气。

我最近的尝试是:

 RewriteCond %{QUERY_STRING} ^.+$
 RewriteRule ^a-page/$ http://www.mysite.com/a-page/? [L,R=301]

有什么建议吗?

4

1 回答 1

0

好吧,我找到了解决方案:

RewriteCond %{QUERY_STRING} . [NC]
RewriteCond %{REQUEST_URI} /a-page/
RewriteRule ^ a-page/? [L,R=301]
于 2012-12-09T16:04:03.740 回答