虚拟主机重定向错误

时间:2011-08-10 14:53:42

标签: apache2 dns virtual-hosts

大家好,我遇到以下虚拟主机的问题:

<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName www.domain1.com
ServerAlias domain1.com *.domain1.com
DocumentRoot /var/www/vvr
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>
<Directory /var/www/vvr>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
</Directory>


</VirtualHost>


<VirtualHost *:80>
ServerAdmin admin@domain2.com
ServerName www.domain2.com
ServerAlias domain2.com *.domain2.com

# Send servlet for context / jsp-examples to worker named worker1
JkMount / worker1
JkMount /domainDocuments worker1 

# Send JSPs for context /jsp-examples/* to worker named worker1
JkMount /* worker1
JkMount /domainDocuments/* worker1 

当我输入www.domain1.com时,此配置正常,但是当我尝试仅访问域名时:

http://domain1.com,该网站将我重定向到www.domain2.com?为什么这是hapenning。非常感谢。

1 个答案:

答案 0 :(得分:0)

您的VirtualHost定义对我来说很好。您可以检查.htaccess文件以确保没有重定向将domain1.com发送到www.domain2.com。