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 created a simple static web site and have two separately registered domains and I want to be the primary domain name and all requests coming in to to be routed to How do I configure my DNS server to do this? I was assuming all I needed was a CNAME record as below, but this is not working. Here's how I setup my DNS zone file. (Note: all requests to work fine)

; [154997]
$TTL 86400 
@   IN  SOA (
@       NS 
@       NS
@       NS 
@       NS
@       NS
@           MX  10
@           A
mail        A
www         A       CNAME           CNAME
share|improve this question
Quick question, what does your DNS zone look like? – KJ-SRS Feb 2 '11 at 16:47

You have to put the CNAME entries in a zonefile for the domain. How should DNS now it has to look into when it looks for

share|improve this answer

Your understanding of CNAME records is backwards. For the hostname "" to alias to the hostname "" you would need to put the CNAME record into the "" zone, not the "" zone.

A silly analogy would be physical mail forwarding with the postal service. You file a request to forward mail from your old post office to the new address (the CNAME record in the zone), because the mail is going to come to the old post office. Filing a forward request at the new post office (putting the cname into the "" zone) isn't going to help because your old mail isn't coming to the new post office to begin with.

share|improve this answer
+1. Clear answer and explanation. – Carlos Garcia Feb 2 '11 at 17:12

Assuming you can ping your server using (if not - see SvenW answer) that should work without any problems as long as you have your web server configured properly to handle your second domain too ( This way you can have two domains serving the same content independently.

If you want to be really redirected (so that the location bar shows, you should probably do it on the webserver level.

share|improve this answer

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.