首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 服务器 > Apache >

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

2012-09-04 
apache配置,让多域名指向一个域名VirtualHost *:80 ServerAdmin investide@investide.cnDocumentRoot C:

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

热点排行