What Is a CNAME Record? How It Works for Domain Redirects

Michel BardelmeijerMichel Bardelmeijer

Michel Bardelmeijer is Tech Lead and Sales at redirect.pizza, where he helps DevOps and IT teams solve domain redirect challenges at scale. Michel has guided organizations like SD Worx, Zurich Airport and Harvard through complex redirect scenarios involving thousands of domains.

Have questions about bulk redirects, HTTPS migrations, or domain consolidations? Connect with Michel on LinkedIn or reach out to the redirect.pizza team.

A CNAME record is how you point a domain to a redirect service without hardcoding an IP address.

Your registrar or DNS provider asks you to create a CNAME record when you set up a domain redirect. It tells the DNS system to send traffic from your domain to the servers that handle the redirect. No IP address in your config, no manual updates if the service changes infrastructure.

Most CNAME guides explain it as "an alias for www" and leave it at that. If you are staring at a DNS settings page wondering what to type in the Value field, this is the page.

Key Takeaways

  • A CNAME record maps one domain name to another domain name. It never points to an IP address directly.
  • DNS-based redirect services use CNAME records to route traffic from your old domain to their servers, where the 301 or 302 redirect is executed.
  • CNAME records cannot be used on apex (root) domains like example.com. For those, you need an A record. See A Record vs CNAME: Which DNS Record for Domain Redirects for the full comparison.
  • If a redirect service changes their server IP addresses, a CNAME-based setup updates automatically. An A record does not.
  • You can verify your CNAME setup with dig or nslookup from the command line, or with online tools like whatsmydns.net.

Orange CNAME database icon with green circular arrows, representing how a CNAME record works for domain redirects

How a DNS CNAME Record Works (And Its Limitations)

A CNAME record points a domain name to another domain name. The DNS resolver follows the pointer until it finds an A record with an actual IP address. The CNAME meaning is straightforward: Canonical Name, an alias that lets one domain borrow another domain's address.

CNAME Record Example

You own blog.example.com and want it on the same server as example.com. Instead of copying the IP into a second A record (and remembering to update both when it changes), you create a CNAME record for the subdomain:

blog.example.com    CNAME    example.com

DNS sees the CNAME, follows it to example.com, finds the A record there (say, 192.0.2.1), and connects. If the IP behind example.com changes later, blog.example.com follows automatically. One A record update, every CNAME stays current.

The same works for www: www.example.com CNAME example.com is one of the most common DNS CNAME entries on the internet.

The rules that matter for redirect setup:

  • A CNAME must point to a domain name, never to an IP address. If your registrar's form accepts an IP in the CNAME field, something is wrong.
  • A domain with a CNAME cannot have other DNS records (A, MX, TXT) on the same name. This is why apex domains (example.com without www) cannot use CNAME: they need SOA and NS records, which would conflict. A Record vs CNAME for Redirects covers the full explanation and workaround.
  • Chaining CNAMEs (one pointing to another pointing to another) works but adds a DNS lookup per hop. Your users pay for that in load time. Avoid it.

How a CNAME Redirect Works

A CNAME record does not redirect by itself. It routes traffic to a server, and that server executes the redirect. When people search for "CNAME redirect," they mean using a CNAME to connect a domain to a DNS-based redirect service. Here is what that looks like in practice:

Step 1: Add your redirect in the service.
Tell it where traffic should go: redirect old-domain.com to new-domain.com. Pick 301 (permanent) or 302 (temporary). Decide whether to forward the path and query string or just the domain. For a walkthrough of the full process, see How to Set Up a Domain Redirect.

Step 2: Create the CNAME record at your registrar.
The service gives you a target address. For redirect.pizza, that is edge.redirect.pizza (see current DNS records for all record types). Go to your registrar's DNS settings and add:

www.old-domain.com    CNAME    edge.redirect.pizza

If you manage many domains, redirect.pizza's DNS management feature can apply the changes automatically.

Step 3: Wait for DNS propagation.
This is the part where you make coffee. DNS changes take anywhere from a few minutes to 48 hours to spread across global nameservers. Most resolve within 1-2 hours. You can check progress at whatsmydns.net.

That is the entire setup. No server to maintain, no config file to edit, no cron job to babysit.

Once propagation completes, any visitor who types www.old-domain.com gets routed to the redirect service's servers via the CNAME. The service checks its configuration, sees the redirect rule you created, and sends the browser a 301 response pointing to new-domain.com.

Why CNAME and not an A record?

An A record points to a static IP. If the redirect service migrates servers or changes IP addresses, your redirect breaks until you manually update your DNS.

A CNAME points to the service's domain name. They control the IP behind it. If they move to new infrastructure, your CNAME follows automatically. You never touch your DNS again.

That is the difference between "set it and forget it" and "set it and hope nobody changes the IP."

The redirect setups that break six months later are almost always A records where the provider did an infrastructure migration. With a CNAME, the customer never notices. We moved our entire European edge fleet last year and not a single CNAME-based redirect went down.

– Michel Bardelmeijer, Tech Lead at redirect.pizza

When CNAME does not work: apex domains.

Apex domains (example.com without a subdomain prefix) cannot have CNAME records. If you need to redirect an apex domain, you use A and AAAA records instead. This is the single most common DNS issue in redirect setup, and A Record vs CNAME for Redirects covers the full explanation, workarounds, and setup examples.

For a broader view of how DNS-level redirects compare to server-side approaches like .htaccess and Nginx, see DNS-Level vs Server-Side Redirects. For an overview of how all redirect types fit together, see the complete guide to URL redirects.

How to Check and Verify a CNAME Record

If your redirect is not working, the first thing to do is a CNAME lookup: check your CNAME record to see if it exists and points to the right target. Think of this as the DNS equivalent of "is it plugged in?"

Three ways to verify your CNAME is set up correctly:

nslookup (Windows, macOS, Linux):

nslookup -type=cname www.old-domain.com

If the CNAME exists:

www.old-domain.com    canonical name = edge.redirect.pizza.

No output for "canonical name" means the record does not exist or has not propagated yet.

dig (macOS, Linux):

dig www.old-domain.com CNAME +short

Returns the target domain if the CNAME is set:

edge.redirectservice.com.

Empty result means no CNAME record found.

Online CNAME checker (browser-based):

whatsmydns.net is the quickest CNAME record lookup tool that works without a terminal. Enter your domain, select CNAME as the record type. The tool queries DNS servers across dozens of locations worldwide. If some show the correct CNAME and others show nothing, propagation is still in progress.

What to check for:

The CNAME should point to exactly the address your redirect service gave you. If it points somewhere else or is missing, that is why your redirect is not working. The classic mistake: you created the CNAME on old-domain.com (the apex) instead of www.old-domain.com. The registrar accepted it without complaint. The redirect does not work, and the error is invisible until you look up the record.

If you just changed your CNAME and the lookup shows nothing, check the TTL on the previous record. A high TTL (like 86400, which is 24 hours) means DNS servers will cache the old value longer before requesting the new one. Most registrars default to 1-4 hours.

Related Guides

Frequently Asked Questions

Only in combination with a redirect service. The CNAME routes traffic to the service, and the service sends the actual HTTP redirect. This is different from URL masking or iframe forwarding, where the address bar keeps showing your old domain while loading the destination in a frame. With a CNAME-based redirect, the visitor's browser fully navigates to the new URL and the old domain disappears from the address bar.

It can. A domain name with a CNAME record cannot have MX records on the same name. If you add a CNAME to mail.example.com and that name also had an MX record, email delivery to that subdomain will break. This is not an issue for most redirect setups, because you typically create the CNAME on www.old-domain.com, not on the apex domain where your MX records live.

Not on the same subdomain. Each subdomain gets one CNAME record. But you can create separate CNAME records on different subdomains of the same domain: www.example.com, shop.example.com, and blog.example.com can each have their own CNAME pointing to different targets.

The redirect stops working as soon as DNS caches expire, which depends on the TTL (time to live) that was set on the record. With a typical TTL of 3600 seconds (1 hour), the redirect will fail for most visitors within an hour of deleting the record. There is no grace period.

Log into your domain registrar or DNS provider (GoDaddy, Namecheap, Cloudflare, or wherever you manage your domain). Find the DNS settings or DNS management page. To make a CNAME record, add a new record and select CNAME as the type. In the Name or Host field, enter the subdomain (like www). In the Value or Target field, enter the domain your redirect service gave you. Save and wait for DNS propagation, which typically takes 1-2 hours. The exact steps vary by registrar.

Ready to redirect?

redirect.pizza is a DNS-based redirect service. Point your CNAME to edge.redirect.pizza and your redirect is live before your coffee gets cold. Automatic HTTPS certificates included. Get started for free.

Pricing Background
Domain redirects delivered hassle-free

Get started right away

  • Free plan
  • No creditcard required
Serving millions of redirects for
Warner Bros.
Harvard
CalTech
Red Bull
Zurich Airport
Nando's
Jaguar
Bam
Kneipp
Culture Gouv FR
SD Worx
Visma
team.blue
ElevenLabs
SRF
Unit4
Ascension
Norlys
Concept2
Teamleader
Chargify
JBS SA
Hirslanden
Dansk Erhverv
Wunderman Thompson
Lerner Publishing Group
RGF Staffing
Apollo
IU
Chabad
MCC
Warner Bros.