.htaccess - 删除/编辑/删除查询字符串参数/标志

时间:2012-09-21 09:06:12

标签: string .htaccess edit

我试图改变这一点:

  

/index.php?param1=1&param2=1&param3=1

进入这个:

  

/index.php?param1=1&param3=1

我原以为这会起作用:

RewriteCond %{QUERY_STRING} param2 [NC]
RewriteRule ^index.php?(.*)param2=([0-9]+)(.*)$ index\.php\?$1&$3 [R=301,QSA,L]

...但它和其他变化正在做所有的事情:(

任何想法?

1 个答案:

答案 0 :(得分:3)

试试这个:

RewriteCond %{QUERY_STRING} ^(.*&)?param2=([^&]+)&?(.*)?$
RewriteRule ^index\.php$ index.php?%1%3 [L,R=301]