coffeeboyuk

Active Member
Nov 12, 2005
43
3
158
Hi,

How do I point mydomain.com to a cname address. I know we can do it using the A record with the @ symbol but is there a solution for the cname?

Kind regards,

L
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
14,307
2,238
363
cPanel Access Level
Root Administrator
Hey there! I'm not sure I totally understand the question. CNAME records are used when you want to point something to a domain name. For example, you could have this record:

Code:
mail IN CNAME mail.domain.com
The "@" in a DNS zone is just a shorthand way of not typing out the entire domain name, and is not related to a particular record type.

Can you let me know what you're trying to do? Are you trying to point the content of domainA to domainB?
 

coffeeboyuk

Active Member
Nov 12, 2005
43
3
158
Hey there! I'm not sure I totally understand the question. CNAME records are used when you want to point something to a domain name. For example, you could have this record:

Code:
mail IN CNAME mail.domain.com
The "@" in a DNS zone is just a shorthand way of not typing out the entire domain name, and is not related to a particular record type.

Can you let me know what you're trying to do? Are you trying to point the content of domainA to domainB?
Thanks for explaining about the shorthand.

Let me explain in more details:

Usually, we can write for A records:


@ IN A 199.9.9.9 - Which resolves mydomain.com to 199.9.9.9

But I want mydomain.com to resolve to a CNAME. So for example if CNAME goes to this.domain.com then mydomain.com will resolve to this.domain.com and not an ip address, how do I do it in?

And the reason for this is because the ip address is changing from time to time so I've been given a cname to point to.
 
Last edited:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
14,307
2,238
363
cPanel Access Level
Root Administrator
Thanks for the additional details. I don't see why you couldn't have a main domain point to a CNAME. You'd just want to replace the main "domain.com IN A x.x.x.x" with "domain.com IN CNAME otherdomain.com" and that would take care of it.
 

coffeeboyuk

Active Member
Nov 12, 2005
43
3
158
Thanks for the additional details. I don't see why you couldn't have a main domain point to a CNAME. You'd just want to replace the main "domain.com IN A x.x.x.x" with "domain.com IN CNAME otherdomain.com" and that would take care of it.
That's exactly what I want to do but cpanel won't accept this. What's the solution?
 

coffeeboyuk

Active Member
Nov 12, 2005
43
3
158
Thanks for the additional details. I don't see why you couldn't have a main domain point to a CNAME. You'd just want to replace the main "domain.com IN A x.x.x.x" with "domain.com IN CNAME otherdomain.com" and that would take care of it.
Are you sure that will work? Let me try it again then
 

coffeeboyuk

Active Member
Nov 12, 2005
43
3
158
It doesn't work. I get the following error:

(note: i replaced mydomain.com with an aliase for privacy reasons)

Error: API failure: Zone is invalid: Line 14: mydomain.com: CNAME and other data; Line 14: mydomain.com: CNAME and other data; Line 14: mydomain.com: CNAME and other data; Line 25: mydomain.com: CNAME and other data at /usr/local/cpanel/Cpanel/ZoneFile/LineEdit.pm line 403.

This is such fantastic feature that it works in other DNS zone but cpanel of all things "holy", does not work!
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
14,307
2,238
363
cPanel Access Level
Root Administrator
I did some more digging on this and found this:

"A CNAME cannot be placed at the root domain level, because the root domain is the DNS Start of Authority (SOA) which must point to an IP address. CNAME records must point to another domain name, never to an IP address."


So while it should *technically* be possible to have this be the only record, as long as an SOA exists, which is required in every DNS zone, this isn't going to be possible.

So no, it doesn't look like this is possible.

It would be better to setup a website and redirect that to the specific page or domain you want.
 

coffeeboyuk

Active Member
Nov 12, 2005
43
3
158
I did some more digging on this and found this:

"A CNAME cannot be placed at the root domain level, because the root domain is the DNS Start of Authority (SOA) which must point to an IP address. CNAME records must point to another domain name, never to an IP address."


So while it should *technically* be possible to have this be the only record, as long as an SOA exists, which is required in every DNS zone, this isn't going to be possible.

So no, it doesn't look like this is possible.

It would be better to setup a website and redirect that to the specific page or domain you want.
If I setup a redirect it will have this funny redirect and when you hover over the links on the page it won't show the orginal website url.

In my zone file the SOA comes naturally. Is there a solution?
 

coffeeboyuk

Active Member
Nov 12, 2005
43
3
158
Do you control both the domains on the same server? If so, you could create an Alias in cPanel so multiple domains point to the same content. Aliases | cPanel & WHM Documentation
If the question you are asking, do I have permission to add my domain to their zone, I believe so. It's a parking company and I have linked my domain to their control panel but I can't add the cname for the life of me in cpanel
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
14,307
2,238
363
cPanel Access Level
Root Administrator
You wouldn't be able to add a second domain to their existing zone either. An Alias sets up a redirect inside the Apache configuration so two domains point to the same content. This way, you just use your standard A record and then the site points to the existing content.
 

coffeeboyuk

Active Member
Nov 12, 2005
43
3
158
You wouldn't be able to add a second domain to their existing zone either. An Alias sets up a redirect inside the Apache configuration so two domains point to the same content. This way, you just use your standard A record and then the site points to the existing content.
I'm not sure I understand, but when you say standard A record you mean having the record point to an IP address of the other server? If that's the case, that's not possible because the other server IP addresses changes now and again.
 

coffeeboyuk

Active Member
Nov 12, 2005
43
3
158
Why don't you guys rebuild the DNS, so we can point the cname to another website address instead of pointing it to an IP address. We need great changes for the good of man kind.
 

coffeeboyuk

Active Member
Nov 12, 2005
43
3
158
Hey guys, just an update but the root of the domain is working with just the cname. Hurrary. That's weird, though because you don't need the @ A record for mydomain.com.
Need to back track what records is causing this to work though.

CNAME resolves to mydomain.com - and it works!