How to Redirect an Apex Domain on Cloudflare (CNAME Flattening Explained)
Most DNS providers can't put a CNAME at the domain root. Cloudflare can, via CNAME flattening — here's the exact setup, and why it's still the better option on Cloudflare specifically.
Almost every DNS provider refuses to let you put a CNAME record at the apex (root) of a domain — it's a restriction from the original DNS specification, not a provider choice. Cloudflare is the one major exception: it supports CNAME flattening, which lets you point your bare domain (yourdomain.com, no www) directly at a redirect service with full HTTPS, no workaround required. On Cloudflare specifically, this is still the better option — traffic stays on Cloudflare's own network and routes to the nearest edge location to each visitor, the way any other Cloudflare-proxied record does.
Why the apex is normally off-limits for CNAME
A CNAME record says "this hostname is an alias for that hostname" — nothing else can share a record at the same name. But the apex of a domain typically needs to hold other record types too (MX for email, TXT for verification, and so on), and the DNS spec doesn't allow a CNAME to coexist with those. So www.yourdomain.com can be a CNAME freely, but yourdomain.com on its own usually can't be.
Cloudflare works around this at the DNS resolution layer: you enter a CNAME-looking record for the apex, and Cloudflare "flattens" it into the correct record types behind the scenes before answering DNS queries. To you, it looks and behaves like a normal CNAME.
Setting it up
- In the Cloudflare dashboard, go to your domain's DNS settings.
- Add a record: Type
CNAME, Name@(this represents the apex — not your full domain name), Target the CNAME value your redirect service gives you. - Add the domain in your redirect service's dashboard.
Every other DNS provider gets a different fix — a static IP address, added as a plain A record, since none of them support flattening the way Cloudflare does. If your domain isn't on Cloudflare, see the Namecheap, GoDaddy, or Route 53 guides instead.
Pairing with www
Most setups want both yourdomain.com and www.yourdomain.com working. www is the easy half — a normal CNAME, no flattening needed, works on any DNS provider. Add both as separate hostnames in your redirect service; RedirectIQ automatically groups a matched www/apex pair onto a single plan slot once both exist in your account, so covering both costs nothing extra.
Verifying it worked
Run the domain through the free redirect checker — you should see a valid certificate, a 301 (or 302, if that's what you configured) status, and the correct destination. If you're troubleshooting a multi-hop setup, the redirect chain analyzer shows every hop along the way.
RedirectIQ provisions and renews the SSL certificate automatically once you add the domain. Start free →