How and When to Use CNAME Records
A CNAME record stands for Canonical Name. This record specifies merely an alias or nickname of a primary host. For instance, if you have a domain name like example.com, but you want users to access it using its ‘www’ part (www.example.com), you can create a CNAME record pointing to the example.com site.
In simple terms, a canonical name is a name that a host is known by, but it is not its real name. It is merely used to associate an alias/extra domain name with a canonical domain name.
You can set your CNAME records on the DNS management interface or sometimes DNS Zone Editor. In this guide, we are going to discuss how and when to use CNAME records.
So When Should You Use a CNAME Record
To associate your server’s IP address with your domain name, you must create an A record to map your domain name to the IP address.
Sometimes, you might need more than one domain name to resolve to the same IP address, and this is where CNAME comes in. This is especially very useful during a transition period. Instead of pointing to an IP address, A CNAME record points to another domain name.
You can use a CNAME record in the following two scenarios.
1. Redirecting Multiple Domains to a Single IP Address
For instance, if you are migrating from example.com to example.org, you can use a CNAME record to redirect visitors to the new domain name.
2. Pointing Several Sub-domains to the Main Domain Name
Apart from your main website, you might have different services running on your domain name through sub-domain addresses. Instead of creating an A record for all these services that point to your IP address, you should create CNAME records for all of them.
This approach has one advantage. If you later change the IP address of your server, you will only have to change one A record and all the CNAMEs will follow the new IP address.
For instance, the below DNS records are associated with the domain name ‘example.com’
Special Notes About CNAME Records
- CNAME records cause multiple requests to be sent to the DNS servers and hence, there can be a few milliseconds delay if you are visiting an alias of a primary domain name.
- Your main domain name should always point to an A record and never point to a CNAME
In this guide, we have defined a CNAME record and where it is applied in the World Wide Web communication. If you were getting some trouble with these DNS terms, you should now be in a position to apply them on your DNS manager without any problems.
Check out these top 3 Domain hosting services:
- Want info about best web hosting? Clicking this link can be of great help.