0

My question is related to the wrong redirection of multi-domain server.

I have a VPS server on ovh.com with 2 domains names:

  • site1.com
  • site2.com

On OVH admin panel, I have set up the DNS zone so that each site return to the IP adress of the server with a type A. Each www.siteX.com have for targetsiteX.com with a type CNAME.

On the server side, I'm using Apache2 and I have created for all a conf file in /etc/apache2/site-available/:

  • site1.conf
  • site2.conf

with the same structure:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName siteX.com
    ServerAlias www.siteX.com
    DocumentRoot /var/www/siteX
</VirtualHost>

Then I have used the command a2ensite subX.conf or a2ensite siteX.conf and sudo service apache2 restart

The problem I have is that www.site2.com is redirected to site1.com while site2.com is correct and return site2.

The interesting aspect is that www.site2.com? is correctly loading the content of site2 while keeping the www.site2.com/? in the url.

Rafnuss
  • 119
  • 1
  • 14

1 Answers1

0

Again, similar to Sub-domain not working, the solution was to disable the default virtualserver:

sudo a2dissite 000-default

Can someone explain the reason ? How to avoid that ?

Community
  • 1
  • 1
Rafnuss
  • 119
  • 1
  • 14
  • 1
    It is because 000-default contains a VirtualHost that overrides some of the directives. – brclz Oct 24 '16 at 11:03