A canonical name (CNAME) record is a simple mapping of one hostname to another or to a fully qualified domain name (FQDN). You might think of it as the DNS record’s “Master of Disguise.” While it doesn’t actually hide anything, it does allow you to establish aliases for your primary domain.

When a domain or subdomain is an alias of another domain, the ‘canonical name’ (CNAME) record is used instead of an A record. CNAME records must always point to a domain, not an IP address. Think of it like a scavenger hunt in which each clue leads to the next, and the last clue leads to the treasure. A CNAME record for a domain is similar to a clue that can lead to another clue (another domain with a CNAME record) or the prize (a domain with an A record).

Consider the case of blog.example.com, which has a CNAME record with the value ‘example.com’ (without the ‘blog’). This means that when a DNS server encounters the DNS records for blog.example.com, it initiates a second DNS lookup for example.com, returning the IP address of example.com via it’s A Record. We’d say that example.com is the canonical name (or actual name) of blog.example.com in this scenario.

When a site has subdomains like blog.example.com or shop.example.com, such subdomains will frequently have CNAME records pointing to the root domain (example.com). Only the DNS records will change if the host’s IP address changes. All CNAME records will follow whatever changes are made to the root domain if a record for the root domain is modified.

A common misunderstanding is that a CNAME record must always resolve to the same website as the domain it points to, however this is not the case. Only the same IP address as the root domain is referenced by the CNAME record. The web server will handle the URL appropriately once the client reaches that IP address. For example, blog.example.com could have a CNAME that links to example.com, pointing the client to the IP address of example.com. But when the client actually connects to that IP address, the web server will look at the URL, see that it is blog.example.com, and deliver the blog page rather than the home page.

Call Now ButtonGive us a Call