[英]ProxyPassMatch for query string not working apache
我使用ProxyPassMatch
将主页(主页)代理到另一个设计不同的站点,它适用于这种情况。
我正在尝试匹配,如果:
example.com/?q=fsds
存在于查询字符串中,如果忽略它,但它不以任何方式工作。 任何想法?
配置:
ServerName https://a24dev.ga
DocumentRoot /home/bitrix/www
SSLProxyEngine on
SSLProxyVerify none
SSLProxyCheckPeerName off
SSLProxyCheckPeerCN off
SSLProxyCheckPeerExpire off
# ProxyPreserveHost on
# ProxyPassMatch ^/?q= !
ProxyPassMatch ^/$ "https://product-qa.z.apteka24.ua"
您无法使用ProxyPassMatch
匹配查询字符串参数,请参阅ProxyPassMatch with regex
另一方面,您应该能够将该指令放在 LocationMatch 指令中,并在查询字符串上使用条件:
<LocationMatch "^/$">
<If "%{QUERY_STRING} =~ /^q=/">
ProxyPassMatch ^/$ !
</If>
<Else>
ProxyPassMatch ^/$ "https://product-qa.z.apteka24.ua"
</Else>
</LocationMatch>
请注意, ProxyPassMatch
的第一个参数在LocationMatch
指令中使用时无关紧要,因为它将使用已经匹配的参数。
更新:似乎您不能在If
部分中使用ProxyPassMatch
,这很烦人,因此如果您启用了mod_rewrite
,则必须改用带有P
标志的 RewriteRules :
RewriteCond %{QUERY_STRING} !^q=$
RewriteRule ^$ "https://product-qa.z.apteka24.ua" [P]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.