2

When I use the following code:

 <VirtualHost *> ServerName subone.domain.tld DocumentRoot /var/www/subdomain/subone/ </VirtualHost> <VirtualHost *> ServerName subtwo.domain.tld DocumentRoot /var/www/subdomain/subtwo/ </VirtualHost> 

Every query goes to /var/www/subdomain/subone. Including: domain.tld, subone.domain.tld, subtwo.domain.tld, ...

When I add a "NameVirtualHost *" to the beginning of the file, everything goes to /var/www

What am I doing wrong?

2 Answers 2

4

I think you are missing the port numbers maybe? e.g. NameVirtualHost *:80

and VirtualHost *:80

2
  • I thought those were implied? I've added it just in case. I also didn't have a "ServerName", adding that changed the behavious aswel. Commented Jan 11, 2010 at 21:38
  • It's not implied. Also, ensure that <VirtualHost *:80> matches whatever you have defined as NameVirtualHost. Example: NameVirtualHost *:80 Commented Jan 11, 2010 at 22:03
2

In my opinion your are missing this entry in your httpd.conf
NameVirtualHost ip_of_your_server:80

--
Regards,
Robert

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.