I have 3 virtual hosts set up like this:

<VirtualHost *:80>
  ServerName www.example.com
  ServerAlias example.com
  DocumentRoot /var/www/html/example
  ErrorLog /var/www/html/example/error.log
  CustomLog /var/www/html/example/requests.log combined
</VirtualHost>

<VirtualHost *:80>
  ServerName www.site1.example.com
  ServerAlias site1.example.com
  DocumentRoot /var/www/html/site1
  ErrorLog /var/www/html/site1/error.log
  CustomLog /var/www/html/site1/requests.log combined
</VirtualHost>

<VirtualHost *:80>
  ServerName www.site2.example.com
  ServerAlias site2.example.com
  DocumentRoot /var/www/html/site2
  ErrorLog /var/www/html/site2/error.log
  CustomLog /var/www/html/site2/requests.log combined
</VirtualHost>

httpd.conf has the following uncommented:

NameVirtualHost *:80

and the following commented

#ServerName www.example.com:80

My DNS has A records

example.com <http://example.com/> -> myIP
*.example.com <http://example.com/> -> myIP

myIP is the same for both records.

site1.example.com <http://site1.example.com/> works fine and goes to the 
correct site.

site2.example.com <http://site1.example.com/> works fine and goes to the 
correct site.

example.com <http://example.com/> does not work and gets into a redirect loop.

What do I need to configure to get example.com <http://example.com/> to work ?

Thanks,

Warren Bell

Reply via email to