重定向URL与参数相同的URL不带参数 [英] redirecting url with parameters to same url without parameters

查看:293
本文介绍了重定向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]

这篇关于重定向URL与参数相同的URL不带参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆