简体   繁体   English

Apache虚拟主机未正确重定向

[英]Apache Virtual Host doesn't redirect proper

I have some problems with apache and virtual host. 我在apache和虚拟主机方面遇到一些问题。 On my host i have 1 website runing, i want to create a subdomain for the forums. 在我的主机上,我有1个网站正在运行,我想为论坛创建一个子域。

When i go forum.domain.com it shows my main page, when i go to domain.com it also points to the main page. 当我转到forum.domain.com时,它显示了我的主页;当我转到domain.com时,它也指向了主页。

<VirtualHost domain.com:80>
    DocumentRoot "C:\wamp\www"
    ServerName domain.com


    <Directory "C:\wamp\www">
        # AllowOverride All      # Deprecated
        # Order Allow,Deny       # Deprecated
        # Allow from all         # Deprecated

        # --New way of doing it
        Require all granted    
    </Directory>
</VirtualHost>

<VirtualHost forum.domain.com:80>
    DocumentRoot "C:\wamp\www\forum"
    ServerName forum.domain.com


    <Directory "C:\wamp\www\forum">
        # AllowOverride All      # Deprecated
        # Order Allow,Deny       # Deprecated
        # Allow from all         # Deprecated

        # --New way of doing it
        Require all granted    
    </Directory>
</VirtualHost>

I also added a 3 DNS A records to my domain, @, www and forum, they all point to my server IP 我还向我的域@,www和论坛添加了3个DNS A记录,它们均指向我的服务器IP

What am i doing wrong here ? 我在这里做错了什么?

Fixed it, 修复,

<VirtualHost domain.com:80>

changed to 变成

<VirtualHost *:80>

For both the virtual hosts. 对于两个虚拟主机。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM