gpt4 book ai didi

linux - Apache 在查询时重定向到主 URL

转载 作者:太空宇宙 更新时间:2023-11-04 11:56:01 26 4
gpt4 key购买 nike

例如,我需要根据查询基本参数重定向 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]

关于linux - Apache 在查询时重定向到主 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54310913/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com