多个域的 OHS 重写规则有困难

Having difficulty OHS rewrite rule for multiple domains

我在为指向相同 IP 地址和端口的多个域重写 Oracle HTTP Server 时遇到一些困难

以下有效

  RewriteEngine On
  RewriteCond %{REQUEST_URI} ^/$
  RewriteRule ^(.*)$ https://sub-doamin-1/psp/UACMP/SELF_SERVICE/SA/c/NUI_FRAMEWORK.PT_LANDINGPAGE.GBL [R,L]

但是当我尝试 https://sub-doamin-2/analytic it redirects to the https://sub-doamin-1/psp/UACMP/SELF_SERVICE/SA/c/NUI_FRAMEWORK.PT_LANDINGPAGE.GBL

尝试了 RewriteCond ${HTTP_HOST} 方法,但没有成功。它只是重定向到 / (root)

RewriteEngine On
RewriteCond ${HTTP_HOST} sub-doamin-1$ [NC]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^(.*)$ https://sub-doamin-1/psp/UACMP/SELF_SERVICE/SA/c/NUI_FRAMEWORK.PT_LANDINGPAGE.GBL [R,L]

RewriteCond ${HTTP_HOST} sub-doamin-2$ [NC]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^(.*)$ https://sub-doamin-2/analytics

能否请您协助解决此问题?

应该是%{HTTP_HOST}而不是${HTTP_HOST}

所以规则应该是:

RewriteCond %{HTTP_HOST} sub1.test.com$ [NC]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^(.*)$ https://sub1.test.com/psp/UACMP/SELF_SERVICE/SA/c/NUI_FRAMEWORK.PT_LANDINGPAGE.GBL [R,L]

RewriteCond %{HTTP_HOST} sub2.test.com$ [NC]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^(.*)$ https://sub2.test.com/analytics [L]

您可以在这里查看规则:https://htaccess.madewithlove.be?share=6632e45c-a7bb-5099-ab0b-468ba1066277

对于网址 https://sub1.test.com and https://sub2.test.com

如果你在那个网站上写下你的原始规则,你会得到 This test string is not supported: ${HTTP_HOST} 所以这对你下次也有帮助。