1

We have an apache server that runs our work Intranet (intranet.domain.com), as well as a test site with restricted access (dummy.domain.com). 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 intranet.domain.com.) 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.

2 Answers 2

1

You have to add a ServerAlias for this other hostname.

1
  • Thans, that sorted it.
    – David Gard
    Feb 29, 2012 at 10:11
1

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 dummy.domain.com instead of drewnett, you have to add drewnett as alias for "main" host

1
  • 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, 2012 at 10:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .