Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Multiple Domains - Apache



Deepan <codeshepherd@example.com> writes:
> I am serving two domains from the same machine
> using Apache. I want www to be used in both of the
> domains, hence I redirect  urls without www to
> appropriate urls with www. I have the following
> configuration in httpd.conf to achieve this.
>        
> 	<VirtualHost  *:80>
> 	DocumentRoot /var/www/html/domaina/
> 	ServerName www.domaina.com
>       ...
> 	</VirtualHost>
>
> 	<VirtualHost *:80>
> 	DocumentRoot /var/www/html/domainb/
> 	ServerName  www.domainb.com
>    ...
> 	</VirtualHost>
>
> However all requests to http://domainb.com/ gets
> redirected to http://www.domaina.com  whereas the
> expected behaviour is to get redirected to
> http://www.domainb.com/ . 

If the requested address is http://domaina.com, then neither of the
vhosts shown are going to apply. Presumably it's defaulting to
www.domainb.com when no vhosts match the request.

You could try adding something like this so that the vhost responds to
requests for http://domaina.com, allowing it to do the redirect:

ServerAlias domaina.com 
or
Serveralias *.domaina.com


//Dave


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links