Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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

I have Linode VPS where I host multiple domains.

Let's say I have

abc.com def.com

Now I've added a wild card subdomain on def.com like

*.def.com

So that whatever I type as a subdomain (e.g. x.def.com, y.def.com), I'm hoping it will go to "def.com".

But instead of going to "def.com", it's taking me to "abc.com".

Is there anything I've missed?

share|improve this question
    
What type of record have you added? Was it A or CNAME? What does dig *.def.com return? – gronostaj Feb 24 '14 at 12:11
up vote 2 down vote accepted

If you're using name-based virtual hosts in Apache, the first virtual host to be defined (in the order config files are processed) is the "catch-all" host.

Unless you have virtual hosts for x.def.com and y.def.com explicitly defined, requests to these hosts will be processed by the "catch-all" host.

share|improve this answer
    
thanks Daniel, is there a way to get around this without explicitly specifying every sub-domain? (I guess I could put def.com first..., but maybe there is a more elegant way? – ericbae Feb 24 '14 at 12:32
    
Elegant, well... It's possible to accomplish this with a dedicated catch-all host (so as not to disturb the regular content) and mod_rewrite: Matching Canonical Hostnames. Be warned though, this contains regex trickery. – Daniel B Feb 24 '14 at 12:45
    
You could use some PHP code in the index file of abc.com to perform a permanent redirection when the HTTP header matches Host: def.com – pkSML Feb 24 '14 at 12:46

You must log in to answer this question.

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