Point CNAME subdomain to main domain

zer4k

Registered
Mar 23, 2011
3
0
51
I need to create a CNAME record like cdn.example.com that points to example.com. I need the following functionality:
when someone asks for cdn.example.com , the server to return the contents of example.com

in WHM i entered a new field like this

cdn 14400 IN CNAME example.com
(i also tried cdn.example.com)

unfortunately, when i access cdn.example.com i get the default apache webpage, and not the homepage of example.com

i know it works if i add cdn.example.com as a parked domain, but i don't want to do it like this, as i think it may involve extra DNS requests when accessing cdn.example.com (pls correct me if i'm wrong on this).

I think the main issue is being able to point the cdn.example.com CNAME to the root folder of example.com on the server. Is it possible to do this without parking cdn.example.com?

thanks!
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
Hello :)

i know it works if i add cdn.example.com as a parked domain, but i don't want to do it like this, as i think it may involve extra DNS requests when accessing cdn.example.com (pls correct me if i'm wrong on this).
Parked domains do not result in additional DNS requests. A separate DNS Zone is created for the parked domain name, which is used in the same manner the original DNS Zone would be.

As for the CNAME issue, please ensure you are using a trailing "." after "example.com". EX:

Code:
cdn 14400 IN CNAME example.com.
Thank you.
 

zer4k

Registered
Mar 23, 2011
3
0
51
yup. i know about the dot :) it's not working.

what if i create the cdn.example.com subdomain from cpanel and then edit in WHM > Edit DNS Zone and transform the cdn entry from
cdn ... A IP
into
cdn ... CNAME example.com.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
Hello :)
what if i create the cdn.example.com subdomain from cpanel and then edit in WHM > Edit DNS Zone and transform the cdn entry from
That should not be necessary. Could you open a support ticket for this issue so we may see the actual domain used and the entries that have been setup in the DNS Zone?

Submit A Ticket

Thank you.