1

Recently I started Multi Sites on my VPS, which is running Centos 64 bit. Currently I have two sites live and each is working fine.

Now the problem is in the URL. I have the following sites:

http://mbas.co.in
http://u-k.in

mbas was the very first site on my VPS

Now both http://mbas.co.in and http://www.mbas.co.in redirect to my mbas website. However, while http://u-k.in redirects correctly to the u-k website, http://www.u-k.in redirects me to the mbas website.

You can test this.

My DNS configuration:

Screenshot of DNS settings

And my Multi Site code is this:

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot /var/www/html/www.mbas.co.in
    ServerName mbas.co.in
    ErrorLog logs/mbas.co.in-error_log
    CustomLog logs/mbas.co.in-access_log common
</VirtualHost>
<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot /var/www/html/u-k.in
    ServerName u-k.in
    ErrorLog logs/u-k-error_log
    CustomLog logs/u-k-access_log common
</VirtualHost>
TRiG
  • 1,181
  • 3
  • 13
  • 30
Niraj Chauhan
  • 252
  • 2
  • 13

1 Answers1

2

Add ServerAlias(The ServerAlias directive sets the alternate names for a host, for use with name-based virtual hosts):

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot /var/www/html/u-k.in
    ServerName u-k.in
    ServerAlias www.u-k.in
    ErrorLog logs/u-k-error_log
    CustomLog logs/u-k-access_log common
</VirtualHost>

then reload apache2.

ooshro
  • 11,134
  • 1
  • 32
  • 31