如何停止的htaccess重写规则结转查询字符串 [英] How to stop htaccess rewrite rule carrying over query string
本文介绍了如何停止的htaccess重写规则结转查询字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我设置了一些重定向。我想重定向以下网址:
I am setting up some redirects. I want to redirect the following URL:
/cms/index.php?cat_id=2
到以下网址:
to the following URL:
/flash-chromatography
该规则目前,我有如下:
The rule I currently have is as follows:
RewriteCond %{QUERY_STRING} ^cat_id=2$ [NC]
RewriteRule ^cms/index\.php$ /flash-chromatography [L,R=301]
这个规则几乎是完美的除了它的URL重定向到以下内容:
This rule is almost perfect apart from it redirect the URL to the following:
/flash-chromatography?cat_id=2
所以你看我的问题是,它至今仍保持着?cat_id = 2
部分的时候,我不希望它。
So you see my problem is it has kept the ?cat_id=2
part when I don't want it to.
我如何阻止它保持该位?
How do I stop it keeping this bit?
推荐答案
只需添加
在重写URL的末尾:
Just add ?
at the end of rewritten URL:
RewriteCond %{QUERY_STRING} ^cat_id=2$ [NC]
RewriteRule ^cms/index\.php$ /flash-chromatography? [L,R=301]
这篇关于如何停止的htaccess重写规则结转查询字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文