DNS Simplified: CNAME Records
DNS Simplified: CNAME Records
What is a CNAME Record?
Canonical Name records, commonly called CNAME records, can be used to alias one name to another. They're often used to avoid maintaining two different records.
Let's say you have a server where you keep all of your documents online. It might normally be accessed through docs.example.com
, but you might also want to access it using documents.example.com
.
One way to do this is to add a CNAME record that points documents.example.com
to docs.example.com
. When someone visits documents.example.com
they'll see the exact same content as docs.example.com
.
How do CNAME records work?
Great question. Let's look at an example:
You have ilovetacos.com
and www.ilovetacos.com
pointing to the same application and hosted by the same server. To avoid maintaining two different records, you can create an A record for ilovetacos.com
pointing to the server IP address, and a CNAME record for www.ilovetacos.com
pointing to ilovetacos.com
.
As a result, ilovetacos.com
points to the server IP address, and www.ilovetacos.com
points to the same address via ilovetacos.com
.
If the IP address changes, you only need to update the record in one place. Just edit the A record for ilovetacos.com
, and www.ilovetacos.com
automatically changes, too.
For a more detailed description, including restrictions, we wrote this handy support article.
Alias domains through URL redirects
In DNSimple, URL redirects provide greater flexibility for websites, because you point a domain to a URL. URL redirects only work with the HTTP protocol.
Let's look at an example:
If you use a URL redirect to point documents.example.com
to http://docs.example.com/
, visitors to http://documents.example.com/
will automatically be redirected to
http://docs.example.com/
.
The address in their browser will change to http://docs.example.com/
.
You can also redirect to a subdirectory on your web site. For example:
customers.docs.example.com
could redirect to
http://docs.example.com/customers/
.
The redirection will even keep subdirectories intact. If we use the previous example:
http://customers.docs.example.com/mystuff
would redirect to
http://docs.example.com/customers/mystuff
.
Between CNAME records and URL redirect records, DNSimple provides a powerful way to ensure visitors to your domain see the domain name you want them to see.
Want to learn more about managing your CNAME records with DNSimple? Take a look at this support article. Have more questions? We'd love to talk. Get in touch
Ready to get started with simple, automated DNS? Try DNSimple free for 30 days.
Posted updated May 2020
Anthony Eden
I break things so Simone continues to have plenty to do. I occasionally have useful ideas, like building a domain and DNS provider that doesn't suck.
We think domain management should be easy.
That's why we continue building DNSimple.
4.3 out of 5 stars.
Based on Trustpilot.com and G2.com reviews.