Having a strange issue configuring apache.

I've got 4 domains

  • www.mydomain.tld
  • www.my-domain.tld

  • www.anotherdomain.tld

  • www.another-domain.tld

I've configured named virtualhost for each of the domains.

mydomain.tld, my-domain.tld and anotherdomain.tld works correctly but another-domain.tld isn't working correctly.

Apache seems to be picking up the virtualhost for anotherdomain.tld and serving it rather than the another-domain.tld

both have the server name set correctly

  • ServerName anotherdomain.tld


  • ServerName another-domain.tld

which seems to be the only place this could be an issue. Does anyone have any suggestion on finding the cause of this error.

A couple of other notes: each virtualhost is in a different file. mydomain.tld and my-domain.tld on a different ip address to anotherdomain.tld and another-domain.tld.

  • 1
    I have a couple ideas - but could you post the relevant vhosts configs? Obviously, feel free to edit the domain names out :) – warren Sep 16 '09 at 8:10
  • 1
    Please paste the relevant bits of configuration -- it's much easier to see. – markdrayton Sep 16 '09 at 8:11
  • What happens if you put the name in quotes? – John Gardeniers Sep 16 '09 at 8:22
  • Are permissions set the same on your 4 config files? – Keith Stokes Sep 16 '09 at 11:20
  • Is it getting caught by your rewrite rules? – Paused until further notice. Sep 16 '09 at 13:13

How can you tell that the web server is serving anotherdomain.tld instead of another-domain.tld? Do you see that URL in the browser's address bar has anotherdomain.tld in it?

If you created these configuration with copy-paste technique, then you could have left the DocumentRoot the same for both domains.

Another guess is if anotherdomain.tld and another-domain.tld are configured on the same IP address for apache, but another-domain.tlp DNS "A" record is set up to a different IP, Apache HTTPD just pulls out the default VirtualHost for the IP specified in its configuration, which may be anotherdomain.tld.

Example: If you have in DNS:

 anotherdomain.tld ->
 another-domain.tld ->

Then in httpd.conf:

 ServerName anotherdomain.tld

 ServerName another-domain.tld

When you type http://another-domain.tld/ in the browser's address bar, it makes a request to, which pulls out the default virtual host for, which is anotherdomain.tld.

These are just two wild guesses though...

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy