What is a CNAME? Functions and How It Works

Have you ever tweaked the DNS zone editor in your domain or web hosting control panel? If so, you may have found a CNAME record.

This DNS record is typically used when you want to link one or more subdomains to the primary domain. In addition, there are still other functions.

What exactly is a CNAME, and how does it work? See the explanation in this article!

What is a CNAME?

CNAME

Canonical Name, or CNAME, is a type of DNS record used to create aliases of domains or subdomains you own.

Suppose you have the domain site.com. At the same time, you want website visitors to be able to access www.situs.com. For this, you can specify site.com as the CNAME of www.site.com.

Then, what is the function of this type of DNS record? Let’s see in the next section.

Function

From the explanation of the definition of CName, it can be concluded that its primary function is to create a pseudonym or alias for the main domain.

In addition, several functions can be found in using this CName. Here are the parts:

Remove Subdomain

One of the problems when using an unpaid hosting service is that the provider assigns an additional name (sub-domain) to the main domain.

Examples such as abcd.hosting.com. So that the domain can be neat and look premium, you can create a domain abcd.com and set it as your CName.

So with this, your site address becomes neater and looks premium.

Connecting Services To Subdomains

Another valuable function of using CName is as a service connector to the subdomain.

For example, a Customer Retention Management service, known as CRM, can be linked to a subdomain.

From this connection process, you can connect a subdomain, namely crm.abcd.com.

Then leverage CName to connect that CRM service platform to your main site.

Redirecting Domains With ccTLD Towards Main Domain

ccTLD is an abbreviation of country-code top-level domain which means a domain name with its existence using a code from a country.

Usually using identities such as .uk, .id, .jp, and others. If you do use the ccTLD for the website,

You can use CName to direct the ccTLD domain to your primary part.

How it Works

The purpose of a CNAME is obvious, which is to allow you to point one domain/subdomain to another. However, how does it work?

To understand this, you need to know the mechanism when someone accesses a website that uses an alias.

For example, you can access www.site.com in a browser. After you enter the URL, the browser will send a DNS request. DNS resolver will look for name servers that have DNS records from site.com.

Then, the DNS resolver will provide the CNAME record from site.com to the browser. Here, the browser understands that www.site.com is an alias of site.com.

Therefore, the same process will be repeated to request the registered IP address for yoursite.com. Only after that browser users can enter the destination website.

Things to Keep in Mind When Using a CNAME

If you want to use a CNAME, there are a few things to keep in mind, including:

  • Domain roots (such as site.com) cannot be used as CNAME. The reason is the root domain can only point to IP addresses.
  • This DNS record can only be pointed to another domain, not an IP address.
  • Avoid pointing one CNAME record to another CNAME record because it is ineffective.
  • A domain cannot have DNS records (MX and TXT records) other than CNAMEs.
  • Not all domains used for email servers have this DNS record.
  • Do not point MX records and NS records to alias domains.

How to Point Another Domain to a Primary Domain with a CNAME

CNAME records allow you to point one domain to another. To do this, you must access your cPanel account by typing in the website URL followed by /cpanel—your site.com/cpanel.

The hosting provider usually provides the cPanel username and password when you purchase a hosting plan.

Once successfully logged in, find and click the Zone Editor menu. In this menu, you can add or remove settings for all DNS records, including CNAMEs.

Conclusion

A CNAME is a DNS record allowing you to use your domain aliases. In addition, you can “delete” subdomains, connect a service to your subdomain, and redirect ccTLDs to the primary domain.