Have you ever tampered with the DNS zone editor in your domain control panel or web hosting? If so, you’ve probably come across CNAME records.
This DNS record is usually used when you want to connect one or more subdomains to the primary domain. In addition, there are also other functions.
What exactly is a CNAME and how does it work? Check out the explanation in this article!
Table of contents close
1 What is a CNAME?
2 Functions
3 Ways of Working
4 Things to Look For When Using CNAME
5 Ways to Redirect Other Domains to the Primary Domain with CNAME
6 Conclusion
What is CNAME?
Canonical Name , also known as CNAME is a type of DNS record that is used to create an alias for a domain or subdomain that you own.
Suppose you have a website domain.com. At the same time, you want website visitors to be able to access via www.situs.com. For this you can specify site.com as CNAME from www.site.com.
So, what are the functions of this type of DNS record? Let’s look at the next section.
Function
In addition to creating aliases from a domain, CNAME has several other functions, namely:
- To “get rid of” a subdomain – If you are using a free hosting service, your website may be in the form of a subdomain. For example site.hosting.com . So, you can create a CNAME with the site.com domain that points to that subdomain.
- To connect certain services to your custom subdomain – Maybe you use customer retention management or CRM for your business. So, you can create a subdomain (crm.website.com, for example) and use a CNAME to connect the CRM service platform to your website. With this, you can access CRM with a custom URL.
- To point a domain with ccTLD to the primary domain – ccTLD or country-code top level domain is a domain name with a country code extension. Examples are .id, .uk, and .jp. If you buy multiple ccTLD domains for your website, you can use CNAME to point them to the main domain.
Procedure
The purpose of a CNAME is very clear, namely that you can point one domain / subdomain to another. However, how does it work?
To understand this, you need to know the mechanism that occurs when someone accesses a website using an alias.
For example, you can access www.situs.com in a browser . After you enter the URL, the browser will send a DNS request. The DNS resolver will look for name servers that have DNS records from www.website.com.
Then, the DNS resolver will provide a CNAME record from website.com to the browser. Here, the browser understands that www.situs.com is the alias of site.com.
Because of this, the same process will be repeated to request the IP address registered for www.site.com. Only after that, browser users can enter the destination website.
Things to Look For When Using CNAME
If you want to use a CNAME, there are a few things to note, including:
- The root domain (for example, website.com) cannot be used as a CNAME. The reason is, the root domain can only point to an IP address.
- 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’s not effective.
- A domain may not have DNS records (MX and TXT records) other than CNAME.
- Not all domains used for mail servers have this DNS record.
- Don’t point MX records and NS records to domain aliases.
How to Redirect Another Domain to the Primary Domain with CNAME
CNAME records allow you to point one domain to another. To do this, you will need to access your cPanel account by typing in the website URL and followed by / cpanel. For example site.com/cpanel .
The cPanel username and password are usually provided by your hosting provider when you purchase a hosting package.
After successfully logging in, find and click the Zone Editor menu . In this menu, you can add or remove settings for all types of DNS records, including CNAME.
To learn the complete method, you can read our guide on how to set DNS .
Conclusion
A CNAME is a DNS record that allows you to use an alias for your domain. In addition, you can “delete” subdomains, connect a service to your subdomain, and redirect ccTLDs to the primary domain.
To point to a domain, you can use the Zone Editor menu on cPanel. For Niagahoster users, you can simply manage this DNS record through the Member Area .
Hope this article helped you to understand what CNAME is, functions and how it works. If you have any questions, feel free to leave a comment in the column provided below this article.
