cl_303303303 发表于 2017-1-12 07:43:55

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
RewriteCond %{HTTP_HOST}   !^$
RewriteRule ^/(.*)         http://www.localhost.com.cn/$1

这样配置后,无论是abc,或者localhost,都会被跳转到localhost.com.cn
页: [1]
查看完整版本: apache配置,让多域名指向一个域名