DNS CNAME or A Record?

If I have one website and two domain names, should the secondary domain have it's own domain zone (and A records) or should it have a CNAME record in the primary domain zone? All I need the secondary domain to do is forward to the first.

1 Reply

Putting in a CNAME record will not make your domain automatically forward to another, if that's what you're looking for. Forwarding needs to be done at the level of your web server. CNAME is just a convenient way of telling users that the IP address of the (sub)domain can be found under the A record of another domain. This is useful if you do not control the IP address of the other domain (for example, if the other domain is your Amazon S3 bucket), or if you want to be able to update many subdomains by changing only one A record in one place. But for other purposes, an A record is much more straightforward.

Besides, I don't think you can put a CNAME record for the whole domain. CNAME is only for subdomains, and the domain itself still needs to have an A record.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct