简体   繁体   中英

Apache Virtual Host doesn't redirect proper

I have some problems with apache and virtual host. On my host i have 1 website runing, i want to create a subdomain for the forums.

When i go forum.domain.com it shows my main page, when i go to domain.com it also points to the main page.

<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

What am i doing wrong here ?

Fixed it,

<VirtualHost domain.com:80>

changed to

<VirtualHost *:80>

For both the virtual hosts.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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