#配置Apache虚拟主机,打开httpd-vhosts.conf;
<VirtualHost *:80>
ServerName www.xxx.com
DocumentRoot "/usr/tomcat/apache-tomcat-7.0.59/webapps/ROOT"
DirectoryIndex index.jsp
ErrorLog "logs/mod_jk-error.log"
CustomLog "logs/mod_jk-access.log" common
JkMount /* controller
JkUnMount /*.gif controller
JkUnMount /*.jpg controller
JkUnMount /*.png controller
JkUnMount /*.css controller
JkUnMount /*.js controller
JkUnMount /*.htm controller
JkUnMount /*.html controller
#设置"Options Indexes FollowSymLinks"为"Options All"
#设置"AllowOverride None"为"AllowOverride All"
<Directory "/usr/tomcat/apache-tomcat-7.0.59/webapps/ROOT">
Options All
AllowOverride All
Order allow,deny
Allow from all
</Directory>
#<IfModule>块即为重写定义区域
<IfModule rewrite_module>
#开启Apache Rewrite功能
RewriteEngine on
#不是以www开头的地址请求都指向www.xxx.com
RewriteCond %{HTTP_HOST} !^www.xxx.com [NC]
RewriteRule ^/(.*) http://www.xxx.com [L]
</IfModule>
</VirtualHost>
<VirtualHost *:80>
ServerName www.xxx.com
DocumentRoot "/usr/tomcat/apache-tomcat-7.0.59/webapps/ROOT"
DirectoryIndex index.jsp
ErrorLog "logs/mod_jk-error.log"
CustomLog "logs/mod_jk-access.log" common
JkMount /* controller
JkUnMount /*.gif controller
JkUnMount /*.jpg controller
JkUnMount /*.png controller
JkUnMount /*.css controller
JkUnMount /*.js controller
JkUnMount /*.htm controller
JkUnMount /*.html controller
#设置"Options Indexes FollowSymLinks"为"Options All"
#设置"AllowOverride None"为"AllowOverride All"
<Directory "/usr/tomcat/apache-tomcat-7.0.59/webapps/ROOT">
Options All
AllowOverride All
Order allow,deny
Allow from all
</Directory>
#<IfModule>块即为重写定义区域
<IfModule rewrite_module>
#开启Apache Rewrite功能
RewriteEngine on
#不是以www开头的地址请求都指向www.xxx.com
RewriteCond %{HTTP_HOST} !^www.xxx.com [NC]
RewriteRule ^/(.*) http://www.xxx.com [L]
</IfModule>
</VirtualHost>