multidomain domain2.com to www.domain1.com

Questions related to the Apache server
Post Reply
Peter_w
Posts: 28
Joined: Tue Aug 19, 2008 9:28 am

multidomain domain2.com to www.domain1.com

Post by Peter_w »

Hi,

I have the following problem:
I have Apache on linux hosting several domains.

When I go the domain with http://www.domain2.com everything is OK.
But when i do http://domain2.com i get redirected to http://www.domain1.com,
domain1.com is my main domain.

The domains are all on 1 IP address and they are pointing to it, so I don't think it is a DNS problem.

Anyone get any idea?
chris
Site Admin
Posts: 180
Joined: Mon Jul 21, 2008 9:52 am

Re: multidomain domain2.com to www.domain1.com

Post by chris »

It might be a setting in your apache config for virtual hosts.

It should look something like this.

Code: Select all

<VirtualHost *:80>
ServerName www.domain1.com
ServerAlias domain1.com web.domain1.com
DocumentRoot /var/www/domain1.com
</VirtualHost>
Make sure you have ServerAlias set.

To be sure, you should post you config.

Code: Select all

/etc/httpd/httpd.conf
or

Code: Select all

/etc/apache2/httpd.conf
and
/etc/apache2/sites-enabled/{virtualhost.conf}
Depending on which flavor of linux you have.
Peter_w
Posts: 28
Joined: Tue Aug 19, 2008 9:28 am

Re: multidomain domain2.com to www.domain1.com

Post by Peter_w »

Thanks, that did the trick.

Any idea how I can direct all the sub domains to www?
Post Reply