URL 通过 apache 重定向

URL redirect via apache

我已经阅读了很多有关 Apache 的教程,并且可以重定向的教程很少 url。 不过,我需要为这个 url 做一个重定向,但我不能't.Any 帮助将不胜感激!谢谢 ! 注意:对 httpd.conf

进行更改

URL : https://example.com/common/webScript.jsp?path=/example/content/latest.rss?section=Insight%26type=Leadershttps://example.com

因为我已经配置了我的域,只需要重定向 URL : /common/webScript.jsp?path=/example/content/latest.rss?section=Insight%26type=Leaders to /

“?”后的 uri 路径字符是查询字符串,您需要使用 %{QUERY_STRING} ^path` 或类似的方法检查它们。粗略示例:

# to capture uri-path with query string starting with "path..." 
# redirect it to /

# for 2.4 with If directive (most modern)
<If "%{QUERY_STRING} =~ m#^path#">
    RedirectMatch ^ /
</If>


# or with mod_rewrite that works with 2.2 too    
RewriteEngine on
RewriteCond %{QUERY_STRING} ^path
RewriteRule ^ / [R,L,QSD]

如果您只想重定向 /common/webScript.jsp 到 / 做一个简单的:

RedirectMatch ^/common/webScript.jsp /