The A
and CNAME
records are the two common ways to map a host name (“name”) to one or more IP addresses. There are important differences between these two records.
The A record points a name to a specific IP. If you want blog.xyz.com to point to the server 185.31.17.134 you’ll configure:
blog.xyz.com. A 185.31.17.134
The CNAME record points a name to another name instead of to an IP. The CNAME source represents an alias for the target name and inherits its entire resolution chain.
An A
record points a name to an IP
. A CNAME
record can point a name to another CNAME
or to an A
record.
Important rules:
- The
A
,CNAME
, andALIAS
records cause a name to resolve to an IP. Conversely, theURL
record redirects the name to a destination. TheURL
record is a simple and effective way to apply a redirect for one name to another name, for example redirectingwww.XYZ.com
toXYZ.com
. - The
A
name must resolve to an IP. TheCNAME
andALIAS
records must point to a name.
You should never use a CNAME record for your root domain name (e.g. XYZ.com).