【发布时间】:2014-03-06 19:07:10
【问题描述】:
我在 CentOS 机器上使用 Apache 和 Tomcat,我想做以下重写:
- 我想处理 abc.com 以在发出请求时重定向到 www.abc.com。
- 我想用 Apache 而不是 Tomcat 加载我的资源
这是我的 conf 文件。它位于 /etc/httpd/conf.d/tomcat.conf
#
# This configuration file enables the default "Welcome"
# page if there is no default index page present for
# the root URL. To disable the Welcome page, comment
# out all the lines below.
#
RewriteEngine on
RewriteRule ^/images/(.*) /images/$1
RewriteRule ^/css/(.*) /css/$1
RewriteRule ^/js/(.*) /js/$1
RewriteCond %{HTTP_HOST} ^abc\.com
RewriteRule ^(.*)$ http://www.abc.com$1 [R=301,L]
NameVirtualHost *:80
<VirtualHost *:80>
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / ajp://127.0.0.1:8009/
ProxyPassReverse / ajp://127.0.0.1:8009/
ProxyPassReverseCookiePath / /
</VirtualHost>
我的 AJP 代理重写工作正常,我只需要在上面进行以下重写。
【问题讨论】:
标签: apache tomcat grails url-rewriting centos