What Is A CNAME?

100% Uptime SLA, 24/7/365 Live Support & Fast Cloud Servers

You may use CNAME records to alias one name with another. CNAME stands for Name Canonical.

If both example.com and www.example.com point to the same application and are hosted by the same server, a typical example is. It's popular to build to avoid having two separate records:

  • An A record for example.com pointing to the server IP address
  • A CNAME record for www.example.com pointing to example.com

As a consequence, example.com points to the IP address of the server, and www.example.com points, via example.com, to the same address. If the IP address changes, all you need to do is update it in one place: just edit the A record for example.com and automatically inherit the changes from www.example.com.

A CNAME record must always point to a separate domain name, never to an IP address directly. If you try pointing a CNAME record to an IP address, you will receive an error. 

The DNS A record is specified by RFC 1035.

Restrictions

  • A CNAME record must always point to another domain name and never directly to an IP address.
  • A CNAME record cannot co-exist with another record for the same name. It’s not possible to have both a CNAME and TXT record for www.example.com.
  • A CNAME can point to another CNAME, although this configuration is generally not recommended for performance reasons. When applicable, the CNAME should point as closely as possible to the target name in order to avoid unnecessary performance overheads.

CNAME record format

The layout of an A record follows the standard description of the top-level format established by RFC 1035. The section RDATA consists of one single element:

Domain-name: A domain name which specifies the canonical or primary name for the record.

The canonical representation is:

CNAME <domain-name>

where <domain-name> is a fully-qualified domain name such as example.com.

In DNSimple, the CNAME record is represented by the following customizable elements:

 

Name: The host name for the record, without the domain name. This is generally referred to as “subdomain”. We automatically append the domain name.

TTL: The time-to-live in seconds. This is the amount of time the record is allowed to be cached by a resolver.

Content: The domain-name the CNAME maps to.

CNAME and Redirect

The CNAME record is often mistakenly referred to as a redirect, usually in the form of web redirects (HTTP).

There is no clear connexion between a CNAME and an HTTP redirect, nor does any HTTP redirect result automatically from the CNAME configuration.

The server responding to an HTTP request must be configured to return an acceptable HTTP response in order to execute an HTTP redirection. Using a CNAME is not explicitly feasible.

 

Registered in England and Wales with company number 12201331.

Registered Office: 252 High Street, Aldershot, 
United Kingdom, GU12 4LP
cloud-syncearthbullhorn