Lorixen.
EN

Root domain and a host that wants a CNAME: what to do

Short answer: Many modern hosts, website builders and CDNs ask you to point your domain at them with a CNAME record, such as "point www to yoursite.host.example". That works for www, but DNS rules do not allow a CNAME on the bare root domain, yourdomain.com, because the root also holds your email and verification records. The fixes: use your DNS provider's CNAME flattening, ALIAS or ANAME feature, use fixed IP addresses if the host provides them, or serve the site on www and redirect the root to it. Do not delete your MX or TXT records to make a CNAME fit.

Why the root domain is special

The root of your domain, often called the apex or zone apex, is where several essential records live: the MX records that route your email, the TXT records for SPF, DKIM, DMARC and service verifications, and the NS and SOA records that define the zone itself.

A long-standing DNS rule says a CNAME cannot sit alongside other records. RFC 1912 puts it plainly: a CNAME record is not allowed to coexist with any other data, so if a name is an alias you cannot also give it an MX record, an A record, or even a TXT record. Amazon's Route 53 documentation states the practical consequence: you cannot create a CNAME record for example.com at the zone apex.

So when a host's setup screen says "add a CNAME for your domain", the instruction really only works for subdomains such as www or shop.

Option one: CNAME flattening, ALIAS or ANAME

Many DNS providers offer a feature that behaves like a CNAME at the root without breaking the rules. The DNS provider looks up where the alias points and answers with the resulting IP addresses, so the outside world sees normal A and AAAA records.

Cloudflare calls this CNAME flattening, and its documentation says it allows you to use a CNAME record at your zone apex: Cloudflare finds the IP address the CNAME points to, following multiple lookups if necessary, and returns that final IP address instead of a CNAME record. Route 53 offers alias records, which, unlike a CNAME, you can create at the zone apex, for example routing example.com to a supported AWS resource. Other providers call similar features ALIAS or ANAME records.

Things to check:

  • Not every DNS provider supports it. If yours does not, consider moving DNS to one that does, carefully.
  • Some features only work with targets inside the same provider's ecosystem, as with Route 53 alias records pointing at AWS resources.
  • Cloudflare notes that if a CNAME is used to verify a domain for a third-party service, flattening may cause verification to fail, because the CNAME itself is no longer returned.

Option two: fixed IP addresses from your host

Some hosts provide stable IP addresses for the root domain, often listed in their custom domain instructions as A records. If they do, use those for the root and the CNAME for www. The downside is that if the host ever changes those addresses, you have to update your records, so follow their announcements.

Option three: serve on www and redirect the root

The simplest and most portable approach: make www.yourdomain.com the main address, pointing it with a CNAME as the host asks, and redirect the bare domain to it. The redirect can come from your DNS provider's redirect feature, your registrar's forwarding, or a small redirect service with HTTPS support. Make sure:

  • The redirect is permanent, a 301 or 308, so search engines consolidate on www.
  • It works over HTTPS, not just HTTP, so visitors typing https://yourdomain.com do not see a certificate error.
  • It keeps the path, so yourdomain.com/contact goes to www.yourdomain.com/contact.

Subdomains for shops, booking and help centres

The same question comes up with other services. A hosted shop, booking system or help centre usually asks for its own subdomain, such as shop.yourdomain.com or book.yourdomain.com, with a CNAME. That is fine, because the subdomain holds no other records. Keep a simple list of which subdomain points where, and remove the record when you stop using a service, so an abandoned subdomain cannot be claimed by someone else on that platform.

What never to do

  • Do not delete MX records to make room for a CNAME. Your email will stop arriving.
  • Do not remove SPF, DKIM or DMARC TXT records, or emails start landing in spam.
  • Do not add a CNAME at the root anyway if your DNS provider's interface allows it; some do, and the result can break email and other services in confusing ways.

Making the change safely

  1. Export or screenshot your current DNS records before changing anything.
  2. Lower the TTL on records you will change a day ahead, so mistakes clear quickly.
  3. Add the new records and check them with a DNS lookup tool from outside your network.
  4. Test the website on the root and www, over HTTP and HTTPS, on desktop and phone.
  5. Send a test email to and from the domain to confirm mail still flows.
  6. Raise the TTL again once everything works.

A worked example

Picture a hypothetical Perth florist moving her website to a hosted builder that asked for a CNAME on the domain. Her previous developer had tried to add one at the root, and the DNS provider refused because MX and TXT records existed there.

She kept her email records untouched, pointed www at the builder with a CNAME, and used her DNS provider's CNAME flattening for the root after checking the builder supported it. Both addresses now load the new site over HTTPS, the root redirects to www for consistency, and a test email confirmed orders and enquiries still arrive. The whole change took an afternoon with lowered TTLs, and customers noticed nothing except the new design.

FAQ

Is www or the bare domain better for SEO?

Either works if you pick one and redirect the other consistently.

Will CNAME flattening slow my site down?

Generally no. Cloudflare's documentation says it can speed up resolution.

Can I put a CNAME on a subdomain that also needs email?

No, the same rule applies to any name with other records. Use a different subdomain for one of them.

If your new host wants a CNAME and your DNS won't take it, tell us who manages your domain.

Sources

WhatsAppBook a call