2
A
답변
1
예 가능합니다. 내가 오래 전에 준비한 코드를 아래에서 참조 할 수 있습니다.
RewriteEngine On -- This will enable rewrite module
RewriteCond %{HTTP_HOST}%{REQUEST_URI} ^(.*).abc\.domain\.com/([^/]*) [NC] -- This will check Hostname & URI where first (.*) = %1 & second (.*) = %2 variable as we needed dynamic variables so we greped it.
RewriteCond %1<->%2 !^(.*)<->\1$ [NC] -- This will check if condition %1 is not equal to %2 than proceed to rewrite to the rule mentioned below.
RewriteRule ^(.*) http://domain.com:9090/%1$1 [QSA,P] -- This will append %1 in URL so with help of proxy settings it will grab the content from tomcat @ port 9090 with directory name %1 and keep the query string as it is with help of "QSA" string.
RewriteCond %1<->%2 ^(.*)<->\1$ [NC] -- This will check if condition %1 is equal to %2 than proceed to rewrite to the rule mentioned below.
RewriteRule ^(.*) http://domain.com:9090$1 [QSA,P] -- This will not append %1 in URL so with help of proxy settings it will grab the content from tomcat @ port 9090 with directory name %1 and keep the query string as it is with help of "QSA" string.