Server Fault is a question and answer site for system and network administrators. 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 registered my domain and along with it they gave me for free. I don't really like it, but as I said, they gave it to me for free... And I want to route absolutely every request involving to, including subdomains.

In the DNS configuration of, I set up @ and www, as well as the wildcard subdomain * as A records to my host's IP address,

For the DNS configuration of, I was thinking of using 301 redirects but they don't play well with wildcard subdomains, or at least I have no idea how to achieve the automatic mapping I want, i.e., without having to do it manually for each subdomain and not use without the wildcard.

Since I really want to make the canonical name and have just as a cheap alias, it makes sense to resort to CNAME records, but how can I do that in order to achieve the mapping???

I'd appreciate your most educated advice!

Edit: I'm a DNS n00b... Also, it seems I can only edit my domain's DNS settngs on my registrar's website.

Edit: I'm using IIS.

share|improve this question
DNS is not capable of doing a "redirect". What you're asking for is not possible. The answer below is how to do a redirect, which is part of the HTTP protocol (again, not part of DNS). – Chris S Sep 10 '13 at 19:59
Thanks for the advive. But so, does that mean that I am "doomed" to write a redirect rule or URL-rewrite rule on IIS to achieve what I want??? I have to say that I am somewhat incredulous about that fact... Would you recommend then simply going 1 by 1 on my sub-domains instead of using wildcards, and make each the CNAME for each – khovanskiiªn Sep 10 '13 at 20:43
Sorta yes. The easiest way to do what you want is to have one Rewrite rule in IIS, if the hostname doesn't match whatever you want the canonical name to be, then Redirect to the canonical name. Within each of the other domains, create a "default record" (usually a "@" A Record) which points to the web server. This way a user can type and the server will get the request, see the wrong name, and redirect to – Chris S Sep 10 '13 at 22:10

Add following in front of your virtual host:

<VirtualHost *:80>
    ServerAlias *
    RedirectPermanent /
share|improve this answer
I forgot to mention: I'm a DNS n00b... Also, it seems I can only edit my domain's DNS settngs on my registrar's website. – khovanskiiªn Sep 10 '13 at 18:00
His answer is for inside Apache, not in DNS. – TheFiddlerWins Sep 10 '13 at 18:02
Oh, OK, thanks for the clarification. But in that case, since I am using IIS are you saying that I should do this via some Redirect/URL-Rewriting??? Isn't there a DNS solution to this? – khovanskiiªn Sep 10 '13 at 18:04
You have to do this via redirect, if you want the as result. If can stand in the browser, simply let IIS react on both domains and the DNS settings on both domains can be simply the same. – Patrik Karisch Sep 10 '13 at 18:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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