.htaccess完全删除GET



我有几十个来自旧页面的重定向,例如index.php?mode=1,2,3,0,我想去掉所有的get参数,因为新页面无论如何都只是纯html。

RewriteCond %{REQUEST_URI}  ^/index.php$
RewriteCond %{QUERY_STRING} mode=17,0,0,0,0$
RewriteRule (.*) /big-mamas-house/ [R=301,L]

我原以为删除(.*)就可以了,但根据以下内容,该规则不再适用:http://htaccess.madewithlove.be/

您的规则可以简化为:

RewriteCond %{QUERY_STRING} ^mode=17,0,0,0,0$
RewriteRule ^index.php$ /big-mamas-house/? [R=301,L,NC]

最后需要?来去除任何以前的查询字符串。

最新更新