My current DNS configuration has the blank hostname as well as www going to the VPS's IP address, and they're being served up fine. mail has a CNAME that goes to Google Apps for convenience purposes.

Is there anyway to specify that any other subdomain (is that the right word) like foobar.mydomain.com goes to a particular IP?

I'd like to do this so I can add new subdomains on the fly through Apache rather than having to explicitly declare it in the DNS entry, which is my current option. Are there any major reasons why I should avoid this wildcarding?


1 Answer 1


It is a poor idea, and I'd really strongly urge you to continue to continue to make the DNS records.

The problem you are creating is that it then becomes impossible to detect an invalid host name, since every possible host name on that domain is now valid. This consequence will be felt across all protocols not just for web traffic.

One particular example is if you have any windows shares that you access through NetBIOS names, you will cease to be able to access them by name, as the DNS will resolve the name, rather than as before failing and then windows trying the WINS server / broadcasting.

Likewise testing for a new machine on the network - checking its DNS name is up and ready, give it a quick ping - yep that worked, ohh no it didn't, you just successfully ping'ed the webserver.

  • Thanks! This is exactly the answer I was looking for! Your NetBIOS note is beyond my current comprehension (no worries; thanks for the example), but the second point about adding new machines is a very reasonable one. Interestingly, the hosting providers I have worked with for my clients (e.g., MediaTemple) have this catchall behavior. I suppose it's for ease of the webmaster in adding subdomains on the fly, but you definitely provide a strong reason why not to do it.
    – Steven
    Nov 21, 2010 at 1:43

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