我尝试使用以下代码从查询字符串重定向网址:
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^?#\ ]*)\?[^\ ]*\ HTTP/
RewriteRule (.+) http://www.example.com/$1? [R=301,L]
这适用于: www.example.com/mypage.html?gclid=xxx
但它不起作用:
www.example.com/?gclid=xxx
www.example.com/mypage.html/?gclid=xxx
也尝试失败[1]:这个回答[问题]:Redirecting in HTACCESS from Query String to URL
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /\?gclid=([a-z]+)&type=([a-z\-]+) [NC]
RewriteRule ^ /%1/%2? [L,R=301]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /\?gclid=([a-z]+)($|\ ) [NC]
RewriteRule (.+) http://www.example.com/$1? [R=301,L]
我可以做些什么改变?
非常感谢