简体   繁体   English

htaccess从网址中删除特定的查询字符串

[英]htaccess to remove specific query string from url

I have the URL 我有网址

http://example.com/index.php?err=true&i=1

The i value changes 1 to 3. I want to transform that URL into this: i值将1更改为3。我想将该URL转换为:

http://example.com/index.php?err=true 

Whenever the query string parameter i is found in the URL, the i has to be removed from the URL. 只要在URL中找到查询字符串参数i ,就必须从URL中删除i

You can use this rule to remove parameter i from the query string from any position: 您可以使用此规则从任意位置的查询字符串中删除参数i

RewriteEngine On

RewriteCond %{THE_REQUEST} \?(.*&)?i=[^&]*&?(\S*)\sHTTP [NC]
RewriteRule ^ %{REQUEST_URI}?%1%2 [R=308,NE,L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM