我在AWS Elastic Beanstalk(Tomcat 8)上测试webapp。
我想将第三级域请求重写为特定网址。
例如:
请求 aaa.example.com 重写 example.com /#!aaa
请求 bbb.example.com 重写为 example.com /#!bbb
等...
这是Elastic Beanstalk /etc/httpd/conf.d/elasticbeanstalk.conf
<VirtualHost *:80>
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://localhost:8080/ retry=0
ProxyPassReverse / http://localhost:8080/
ProxyPreserveHost on
RewriteEngine on
RewriteCond %{HTTP_HOST} ^aaa.example.com [NC]
RewriteCond %{HTTP_HOST} ^www.aaa.mydomain.com [NC]
RewriteRule ^(.*)$ http://www.example.com/#!aaa$1 [L]
RewriteCond %{HTTP_HOST} ^bbb.example.com [NC]
RewriteCond %{HTTP_HOST} ^www.bbb.example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/#!bbb$1 [L]
RewriteCond %{HTTP_HOST} ^ccc.example.com [NC]
RewriteCond %{HTTP_HOST} ^www.ccc.example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/#!ccc$1 [L]
ErrorLog /var/log/httpd/elasticbeanstalk-error_log
</VirtualHost>
但是重写不起作用 希望它足够清楚,你能指出我正确的方向吗?