日期:2014-05-16  浏览次数:20863 次

apache配置,让多域名指向一个域名
<VirtualHost *:80 >
ServerAdmin investide@investide.cn
DocumentRoot C:/java/tomcat-6.0.20/webapps/ROOT
ServerName localhost
ServerAlias localhost.com.cn www.localhost.com.cn abc cde 192.168.25.102

RewriteEngine on
RewriteLog logs/rewrite.log
RewriteLogLevel 0

RewriteCond %{HTTP_HOST}   !^www\.localhost\.com\.cn [NC]
RewriteCond %{HTTP_HOST}   !^$
RewriteRule ^/(.*)         http://www.localhost.com.cn/$1 [L,R]

这样配置后,无论是abc,或者localhost,都会被跳转到localhost.com.cn