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 [email protected]
    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 [email protected]
    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>

1 Answer 1

2

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

<VirtualHost *:80>
    ServerAdmin [email protected]
    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.

3
  • hey thanks mate, such an easy one I couldn't find, really thanks Feb 18, 2011 at 6:24
  • @ntechi if the answer is correct, then confirmed it
    – ooshro
    Feb 18, 2011 at 6:30
  • yes I was doing it, but it was popping out, you can mark this answer after 5 mins Feb 18, 2011 at 6:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .