读书人

apache配备让多域名指向一个域名

发布时间: 2012-09-04 14:19:30 作者: rapoo

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

读书人网 >Apache

热点推荐