[英]Apache redirect to main URL on Query
我需要例如基於查詢基本參數重定向Apache
https://example.com/?ampostpreserve=01902018
我需要重定向到https://example.com 。
RewriteEngine On RewriteCond%{QUERY_STRING} ^ ampostpreserv $ RewriteRule(。*) 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]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.