What's a CNAME? All About Your Domain Name
Your website's DNS settings can be a confusing space. For example, when it comes to your domain name, there's different terminology to describe its specific records and functions.
So, to help bring some clarification, we’re explaining what CName records are and how they interact with your website address.
There's no time like the present, so let's get into it...
What's a CName record?
First, let’s remind ourselves what a web domain name actually is.
In short, a domain name is your website's address that people type into their browser URL bar to visit your website. This address points to an IP address such as:
IP addresses like this are hard to remember, and this is where your domain name comes in. A domain name like example.com is much simpler to remember than 126.96.36.199.
The domain name record that points towards the IP address is called an 'A Record.' But further redirection might be necessary if your website is accessible via slightly different addresses.
The most common example is for an address like www.example.com to point towards the A record: example.com.
But you may also have subdomains and other hostnames to consider.
These aliases of the A Record, example.com, are called CNames (Canonical Names).
This means that when a user types in a CName, they’re redirected back to the linked IP address. So, for example, suppose your server changes and you need to change the IP of your website. In that case, you now only need to change the A Record; everything else will follow automatically.
Note: Don't confuse CNames with HTTP redirects. The responding server has to be configured for an appropriate HTTP response for an HTTP redirect to function. This can’t be achieved using a CNAME alone, and the two terms have no direct correlation.
CName records are structured in the syntax name, type, value, which may read as follows:
Test.example.com CNAME example.com
...Which, in this example, reads as:
Test.example.com is an alias for the CNAME (canonical name) example.com. Thus, if a user requests test.example.com, the answer will be example.com.
Note: The syntax in which the CName is written on the left-hand side often causes confusion.
The Limitations of CNames
You need to consider a few things when creating a CName. Most importantly, a CName can never directly point towards an IP address. It can only point to another domain.
Secondly, CName records can’t coexist with another record of the same name. As such, you can’t have a CName and A Record at the same time.
You should also avoid pointing a CName record to another CName record due to lack of efficiency.
Did That Clarify Things?
So to sum it up, CNames are web records that redirect client requests to an A record, which points towards an IP address. However, they cannot point towards IP addresses themselves and don't act as an HTTP redirect. Instead, they record names that are an alias to the A Record.
For more info, click here to see how you set up a CName for your branchbob online store.