在Oracle HTTP Server上针对指向相同IP地址和端口的多个域进行重写时,我遇到了一些困难
关注正在工作
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时,它会重定向到https://sub-doamin-1/psp/UACMP/SELF_SERVICE/SA/c/NUI_FRAMEWORK.PT_LANDINGPAGE.GBL
尝试了RewriteCond $ {HTTP_HOST}方法,但没有成功。它只是重定向到/(根)
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
能否请您协助解决此问题?
答案 0 :(得分:0)
应为%{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
URL https://sub1.test.com和https://sub2.test.com
如果您在该网站上编写原始规则,您将获得This test string is not supported: ${HTTP_HOST}
,这样下次也可以为您提供帮助。