This question already has an answer here:

I would like to redirect domain1.com to domain2.com using DNS. I would further like to redirect www.domain1.com to www.domain2.com.

For domain1.com zone file, do I need to have an A record or are CNAME records sufficient, e.g.

*                               IN      CNAME           domain2.com.
www.domain1.com                 IN      CNAME           www.domain2.com.

The goal is that when visitors visit domain1.com or www.domain1.com, they go to domain2

marked as duplicate by yoonix, Andrew B, Zoredache, masegaloeh, MadHatter Feb 28 '15 at 7:43

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 4
    DNS doesn't have the ability to 'redirect'. What you have above says 'www.domain1.com is the same thing as www.domain2.com'. Maybe that's what you want, but that's not a redirect which is at the HTTP protocol. – yoonix Feb 27 '15 at 21:22
  • OK, so it seems it is not possible?? – user788171 Feb 27 '15 at 21:27
  • @yoonix, that doesn't help answer the question. – user788171 Feb 27 '15 at 21:27
  • 1
    I edited a note in parenthesis into that comment: you may need to refresh your page. As for whether yoonix's comment helps answer the question...that doesn't matter. It's a comment. And a very applicable one, because you can't use DNS to perform a redirect. If you're not trying to accomplish a HTTP redirect, then please word your question differently. Many people think DNS handles website redirection. – Andrew B Feb 27 '15 at 21:30
  • You also cannot use a CNAME at the root of a zone, so that's yet another reason why you can't do this for domain1.com. – MadHatter Feb 28 '15 at 7:43


You can redirect using your web server configuration, or with your preferred scripting language (such as PHP).

With DNS you can only point to the server, like you did in your example, but the domain name won't change from one to the other.

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