htaccess 301 重定向 GET 参数并将其删除
htaccess 301 redirect GET-Parameter and remove it
我需要 301 重定向,示例如下:
页数
应重定向至
但是我真的不知道怎么解决。
我尝试过的:
RewriteCond %{query_STRING} ^id=(.*)$
RewriteRule https://www.example.com/ [R=301,L]
您需要在目标 URI 的末尾使用 ?
来去除任何现有的查询字符串。如果目标在同一域中,您也可以使用相对目标 URI。
使用这条规则:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^id= [NC]
RewriteRule ^(?:index\.php)?$ /? [R=301,L,NC]
我需要 301 重定向,示例如下:
页数
应重定向至
但是我真的不知道怎么解决。
我尝试过的:
RewriteCond %{query_STRING} ^id=(.*)$
RewriteRule https://www.example.com/ [R=301,L]
您需要在目标 URI 的末尾使用 ?
来去除任何现有的查询字符串。如果目标在同一域中,您也可以使用相对目标 URI。
使用这条规则:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^id= [NC]
RewriteRule ^(?:index\.php)?$ /? [R=301,L,NC]