重定向URL与参数相同的URL不带参数

重定向URL与参数相同的URL不带参数

问题描述:

使用的.htaccess文件,我想重定向这样的网址:

Using the file .htaccess, I am trying to redirect urls like this:

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

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

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

so basically redirecting url not caring about params values to the same url without any param.

我用的RewriteCond /重写规则,重定向和RedirectMatch,但没有任何运气。

I have used RewriteCond/RewriteRule, Redirect and RedirectMatch but without any luck.

我的最新的尝试是:

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

任何建议?

好吧,我已经找到了解决办法:

Well I have found a solution:

RewriteCond %{QUERY_STRING} . [NC]
RewriteCond %{REQUEST_URI} /a-page/
RewriteRule ^ a-page/? [L,R=301]