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


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?

  • 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

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.

  • 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

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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