Subdomain CNAME Record – Adding CNAME Without Putting the Subdomain

cname-recordsubdomain

I want to point www.example.com or example.com to abc.example2.com.

In my cname zone settings for example.com, I have added a cname as follows:

name: www.example.com
type: cname
value: abc.example2.com

and so when I visit www.example.com it shows me the content of abc.example2.com which is absolutely correct. But when I visit example.com (without www or any other sub domain), it's not working. I even tried adding a record set as follows:

name: example.com
type: cname
value: abc.example2.com

But it gives me the following errors in 2 different DNS hosting websites:
Route 53

RRSet of type CNAME with DNS name example.com. is not permitted at apex in zone example.com.

DYNDNS

CNAME cannot be created with label that is equal to zone name or in use for another record type.

Now, how can I achieve when visiting example.com it should show the content of abc.example2.com ?

Best Answer

When a label (name) is a CNAME, no other records are allowed for it. so you can't have something like:

www.example.com  A     1.2.3.4
www.example.com  CNAME test.example.com.

The effect of this, is that you can never have a CNAME for the bare example.com domain, as there are always other records for it: at least the SOA record and one or more NS records and usually one or more MX records. So this must be an A record instead.

What I usually do is go the other way around: make www.example.com a CNAME for example.com.

Related Topic