How to Use CNAME Records Correctly

CNAME records let you alias one domain name to another, but they come with important restrictions that trip up many people. This guide covers correct usage and common mistakes.

What a CNAME Record Does

Type: CNAME
Name: www
Value: yourdomain.com

This tells DNS resolvers "for www.yourdomain.com, look up yourdomain.com instead" — the actual IP resolution happens through whatever record exists at the target.

Rule 1 — CNAME Cannot Be Used at the Root/Apex Domain

You cannot create a CNAME for yourdomain.com itself (only for subdomains like www) in standard DNS — the root domain must use an A or AAAA record instead. Some DNS providers offer a proprietary workaround (often called "ALIAS" or "ANAME" records) that behaves like a CNAME but is allowed at the apex.

Rule 2 — A CNAME Cannot Coexist with Other Records on the Same Name

If app.yourdomain.com has a CNAME record, it cannot simultaneously have an MX, TXT, or A record — DNS specifications require a CNAME to be the only record for that exact name.

Common Use Cases

Pointing www to the Root Domain

Type: CNAME
Name: www
Value: yourdomain.com

Pointing a Subdomain to a Third-Party Service

Type: CNAME
Name: shop
Value: shops.myplatform.com

Common when using a hosted service (e-commerce platform, help desk tool) under your own subdomain.

Domain Verification for Third-Party Services

Many services ask you to add a specific CNAME record to prove domain ownership before activating a feature (custom domains, SSL certificates issued by that service).

CNAME vs A Record: Which to Use

ScenarioUse
Root domain (yourdomain.com)A/AAAA record (or ALIAS if supported)
www subdomainCNAME to root, or A record with the same IP
Pointing to a service with a changing IPCNAME (more resilient to IP changes at the target)
Pointing directly to your own static VPS IPA record is simpler and slightly faster to resolve

Verifying a CNAME Record

dig CNAME www.yourdomain.com +short

Common Mistakes

  • Attempting to create a CNAME at the root domain (not supported by standard DNS)
  • Adding a CNAME to a name that already has an MX or TXT record, causing a conflict
  • Creating a CNAME chain (CNAME pointing to another CNAME pointing to another...) — adds unnecessary resolution latency and complexity; point directly to the final target when possible

Common Errors

"CNAME and other data" error when saving — another record type already exists at that exact name; remove or consolidate before adding the CNAME.

Subdomain doesn't resolve despite the CNAME being set — verify the target of the CNAME itself actually resolves correctly; a broken chain anywhere fails the whole lookup.

Related Articles

  • DNS Fundamentals: A, AAAA, CNAME, MX, TXT & NS Records Explained
  • How to Point a Domain to Your VPS (A/AAAA Records)
  • How to Troubleshoot DNS Propagation Issues
  • cname record, dns cname, subdomain configuration, dns records
  • 0 Benutzer fanden dies hilfreich
War diese Antwort hilfreich?

Verwandte Artikel

DNS Fundamentals: A, AAAA, CNAME, MX, TXT & NS Records Explained

DNS translates human-readable domain names into the information servers actually need — IP...

How to Point a Domain to Your VPS (A/AAAA Records)

Before your website is reachable at yourdomain.com instead of a raw IP address, you need to...

How to Configure MX Records for Email Delivery

MX (Mail Exchange) records tell the internet which servers handle incoming email for your domain....

How to Enable and Configure IPv6 on Your VPS

IPv6 adoption continues to grow, and many VPS plans include a free IPv6 address alongside IPv4....

How to Configure a Static IP on a Linux VPS

Most VPS providers assign a static (unchanging) IP address by default, but understanding how...