Link to home
Start Free TrialLog in
Avatar of GuildOfDruids
GuildOfDruidsFlag for United Kingdom of Great Britain and Northern Ireland

asked on

apache NameVirtualHost overlaps

I have followed the namevirtualhost settings on apache's website. I dont know where i'm getting it wrong, as the first virtualhost overrides the other.

When I type www.domain1.com it's fine, but when I type www.domain2.com it shows me the content of domain1.

When I change the order, then the domain2 overrides/overlaps domain1.

Help please!! below is the virtual hosts config.


Thanks
NameVirtualHost *:80
 
 
<VirtualHost *:80>
ServerName www.domain1.com
ServerAlias domain1.com *.domain1.com
DocumentRoot /var/www/html/domain1
</VirtualHost>
 
<VirtualHost *:80>
ServerName www.domain2.com
ServerAlias domain2.com *.domain2.com
DocumentRoot /var/www/html/domain2
</VirtualHost>

Open in new window

Avatar of ai_ja_nai
ai_ja_nai
Flag of Italy image

of course, you set aliases for the host namevirtualhost (which is *); and the order determines the priority; this means that domain1.com has higher priority over domain2.com
look here(http://httpd.apache.org/docs/1.3/vhosts/examples.html#purename)
Avatar of GuildOfDruids

ASKER

Yes but want if I type domain1.com it should show me the content inside domain1 folder and same for domain2, how is that possible?
ASKER CERTIFIED SOLUTION
Avatar of caterham_www
caterham_www
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
typooooo, my bad. I spelled domain name wrong. damn. Thanks alot