Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have an apache server that runs our work Intranet (, as well as a test site with restricted access ( Both are in DNS and both work when I go to the full address, but I also have a CNAME in DNS (drewnett - points to and this is connecting to our test site as opposed to our main site.

Through experimenting I found out that drewnett will take you to the location defined in the first config that it finds (so first alphapetically in this case).

I'm lost for what to check, as Apache Configs must be correct for the full address to connect correctly, and my CNAME has a '.' at the end of it.

Any pointers here would be welcome.

share|improve this question
up vote 1 down vote accepted

You have to add a ServerAlias for this other hostname.

share|improve this answer
Thans, that sorted it. – David Gard Feb 29 '12 at 10:11

Extended version of JohnD's answer

When more than one virtualhost exist in Apache and it get request for host, not known to it (through ServerName or ServerAlias), it returns first virtualhost in list.

In order to get instead of drewnett, you have to add drewnett as alias for "main" host

share|improve this answer
Got it, thanks. I assumed that putting the FQDN against the CNAME would do the trick, but guess it just references that for IP. Thanks again. – David Gard Feb 29 '12 at 10:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.