Mobile app version of vmapp.org
Login or Join
Hamm4606531

: Vhost sends www.* to another domain I created a virtual host at my server to host multiple sites, but I got a few unexpected problems. One sites doesn't gets recognized by the server and is

@Hamm4606531

Posted in: #Apache #Redirects #Vhost

I created a virtual host at my server to host multiple sites, but I got a few unexpected problems. One sites doesn't gets recognized by the server and is redirected to another domain on the server, another one just works without 'www' but the one with the 'www' gets also redirected to a different domain.

The code i use in vhost.conf is:

<VirtualHost *:80>
ServerName domain.com
#ServerAlias domain.com domain.com
DocumentRoot /var/www/vhosts/domain.com
#ServerAdmin mail@domain.com

<Directory /var/www/vhosts/domain.com>
AllowOverride All
</Directory>




It works fine on other domains on the same server. What did i do wrong and how can i fix it?

Thanks in advance!

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Hamm4606531

1 Comments

Sorted by latest first Latest Oldest Best

 

@Si4351233

You need to remove the commented out server alias declaration. By commenting it out the only domain string that would use this vhost file is domain.com. You will probably find that the domain that the www domain is being redirected to is in the default configuration for the server where all connections not specifically handled by vhost files are directed to.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme