我需要在查询基参数上重定向Apache,例如
https://example.com/?ampostpreserve=01902018
我需要重定向到https://example.com。。我试过了
RewriteCond%{QUERY\u STRING}^ampostpreserv上的RewriteEngine$
重写规则(.*)https://example.com[R=301,L]
但似乎不起作用..任何解决方案
谢谢哼哼
最佳答案
似乎您只想删除查询字符串?QSD参数正是这样做的。下面的版本适用于每个被调用的URL。
RewriteEngine On
RewriteCond %{QUERY_STRING} .+
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [QSD,L,R=301]
这是example.com的特定版本和上面的查询字符串:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^ampostpreserve
RewriteRule .* https://example.com [QSD,L,R=301]