Wild Card DNS Record


I am wanting to setup my domains DNS such that anyone that goes to any *.subdomain.com url (w.foo.com, www.foo.com, or monkey.foo.com, or even foo.com) will resolve to www.mydomain.com. What DNS records are needed to do that? Here is what I have right now and so it only resolved to my IP and server if they enter foo.com or www.foo.com. I thought you could enter a CNAME record like [ *, CNAME, foo.com. ], but that messes up everything!!! Is it conflicting with my Google Apps CNAME records or what?

, A, xxx.xxx.xxx.xxx
calendar, CNAME, ghs.googlehosted.com.
docs, CNAME, ghs.googlehosted.com.
mail, CNAME, ghs.googlehosted.com.
sites, CNAME, ghs.googlehosted.com.
start, CNAME, ghs.googlehosted.com.
test, A, xxx.xxx.xxx.xxx
www, A, xxx.xxx.xxx.xxx

Thanks in advance!!


You’ll need a really good excuse to enable wildcarding on a shared server.

If you’re on PS or Dedi ask Support to hook you up.


Ok, I am going to skip the wildcard idea. I now understand that it can cause crazy bandwidth issue and DoS attack issues. Thanks for the feedback anyway.

But, can I route just one subdomain to the main domain foo.com?

(Sub)domain, Type, Target
foo.com, A xxx.xxx.xxx.xxx
"www.foo.com", CNAME, foo.com

How would this be done in the Dreamhost interface? Is it like this? Is there a period at the end? Can you help me with this?

[ , CNAME, foo.com. ]


There might be a better way. What it is you’re trying to do?


I am just wanting foo.com and www.foo.com to both resolve to www.foo.com. My website is running on an apache server with the ScriptAlias set to the wildcard *.foo.com. So, I want any requests made to foo.com to resolve as www.foo.com. Right now I have two separate A records, one for foo.com and another for www.foo.com. Should I use a CNAME record for one instead? Or, do I just need to setup an apache redirect so foo.com is redirected to www.foo.com?


This is commonly done on Apache using a .htaccess file with some conditional rewriting of the request.

RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC] RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]


Or, even simpler, using the “Redirect to add WWW” option in Manage Domains > Edit.