Redirect Your Apex Domain to Your Netlify Site
A free, no-account way to make yourdomain.com 301-redirect to your Netlify-hosted www.yourdomain.com. Auto-renewing SSL, two DNS records, five minutes of work.
TL;DR
Netlify recommends CNAME records for custom domains (apex-loadbalancer.netlify.com), but apex domains can’t CNAME per RFC 1034. Either use Netlify DNS (which handles apex internally via an ALIAS) or point www to Netlify via CNAME and redirect the apex to www using ApexToWWW. Free, automatic SSL.
Why the Netlify Apex Domain Is Tricky
If you’ve ever read Netlify’s docs, you’ve seen the recommendation: point your custom domain to apex-loadbalancer.netlify.com using a CNAME. That works perfectly for www.yourdomain.com. But the moment you try to set the same CNAME on the apex (root) domain — the bare yourdomain.com — DNS bites back. RFC 1034 forbids CNAME records at a zone apex, because the apex must coexist with SOA and NS records that a CNAME would override.
This is the classic CNAME-at-root problem. It affects every static host that uses a load-balancer hostname (Netlify, Vercel, Heroku, GitHub Pages, Cloudflare Pages, and more). Netlify offers two routes around it.
Two Approaches for a Netlify Naked Domain
Option A: Netlify DNS
Move your nameservers to Netlify. Their DNS uses an internal ALIAS / flattened record at the apex, so yourdomain.com resolves directly to Netlify’s load balancer.
Trade-off: all DNS lives in Netlify. Email MX, TXT, and third-party records must be re-created there.
Option B: External DNS + ApexToWWW
Keep your DNS at GoDaddy, Cloudflare, Route 53, Namecheap, etc. Point www to Netlify with a CNAME, and redirect the apex to www via two ApexToWWW records.
Trade-off: none worth mentioning — works with any registrar and any email provider.
Step-by-Step: Option B (External DNS + ApexToWWW)
This is the most flexible setup and the one most Netlify users land on. You keep your existing DNS provider, point www at Netlify, and let ApexToWWW handle the bare yourdomain.com.
Step 1: Add www to your Netlify site
In the Netlify UI, open your site, then go to Site configuration → Domain management → Domains. Click Add a domain and enter www.yourdomain.com. Netlify will mark it as the primary domain and start preparing an SSL certificate for it.
Step 2: Add a CNAME for www at your DNS provider
At your DNS provider (Cloudflare, GoDaddy, Route 53, Namecheap, etc.), create a record:
- Type: CNAME
- Name / Host:
www - Value:
apex-loadbalancer.netlify.com— or, if you prefer, your unique site subdomain likepolite-otter-12345.netlify.app
This is what tells the world that www.yourdomain.com lives on Netlify. If you’re on Cloudflare, set the proxy toggle to DNS only (gray cloud) so Netlify can issue the certificate.
Step 3: Add the apex A record
Add an A record so the bare yourdomain.com resolves to ApexToWWW’s redirect server:
- Type: A
- Name / Host:
@(or blank, depending on the provider) - Value:
65.21.184.101
Step 4: Add the apex AAAA record (IPv6)
- Type: AAAA
- Name / Host:
@ - Value:
2a01:4f9:c012:a304::1
Step 5: Wait for DNS & SSL
Give DNS 5 to 30 minutes to propagate. Netlify automatically provisions a Let’s Encrypt certificate for the www hostname; ApexToWWW does the same for the apex on first request. No manual cert work, ever.
Step 6: Verify the redirect
curl -I https://yourdomain.com
# HTTP/2 301
# location: https://www.yourdomain.com/
If you see a 301 with a location header pointing to your www subdomain, you’re done. Open the apex in an incognito window and confirm the address bar resolves to www.yourdomain.com served by Netlify.
Final DNS Records
| Type | Name | Value |
|---|---|---|
A |
@ |
65.21.184.101 |
AAAA |
@ |
2a01:4f9:c012:a304::1 |
CNAME |
www |
apex-loadbalancer.netlify.com |
Netlify DNS vs. External DNS — Which Should You Pick?
| Feature | Netlify DNS | External DNS + ApexToWWW |
|---|---|---|
| Move nameservers | Yes, required | No |
| Apex A record | Netlify ALIAS (internal) | ApexToWWW (65.21.184.101) |
| Works with email DNS (MX, SPF, DKIM) | Limited — must re-create at Netlify | Yes — unchanged |
| DNSSEC | Not supported | Depends on provider |
| Cost | Free | Free |
If your domain is brand new and you have no email or third-party DNS records to worry about, Netlify DNS is fine. If you already have a working DNS zone — especially with Google Workspace, Microsoft 365, or another mail provider — the external + ApexToWWW route is far less risky. You change two records, nothing else moves.
Using a Different Host?
The same apex-redirect pattern works for any platform that asks you to CNAME www. See guides for Vercel, Heroku, GitHub Pages, and Cloudflare Pages, or read the general apex-to-www guide.
Netlify-Specific FAQ
Does this work with Netlify Functions?
Yes. Netlify Functions are exposed under your site at /.netlify/functions/<name> on whatever hostname Netlify serves. Since your real site lives on www.yourdomain.com, functions are reachable at https://www.yourdomain.com/.netlify/functions/.... Requests to the apex are simply redirected to the same path on www first, so a hit to yourdomain.com/.netlify/functions/foo 301s to www.yourdomain.com/.netlify/functions/foo — the function still runs.
What about Netlify Forms submitted from the apex?
Forms post to your Netlify site via the hostname they’re served from. Because every visitor lands on www after the apex redirect, form submissions originate from www.yourdomain.com and are captured normally. You don’t need any extra configuration. If you have legacy bookmarks that POST directly to the apex, those POSTs will be 301’d — most clients downgrade to GET, so re-issue the form action as https://www.yourdomain.com/... to be safe.
What about branch deploys and deploy previews?
Branch deploys and deploy previews live on Netlify-owned subdomains like deploy-preview-42--your-site.netlify.app. They’re completely independent of your apex DNS, so the ApexToWWW redirect doesn’t affect them at all. You can keep using preview links exactly as before.
Does this break Netlify Analytics?
No. Netlify Analytics counts requests at the edge for any hostname attached to your site. Since traffic to the apex is redirected to www before hitting Netlify, those visits show up in Analytics as page views on www.yourdomain.com — which is what you want for clean, consolidated reporting. You won’t see split stats between the apex and www.
Can I use this with a custom Netlify Edge Function?
Yes. Edge Functions run on requests to your site origin. The apex redirect happens before the request ever reaches Netlify’s edge, so your edge functions only see the canonical www traffic.
Set Up Your Netlify Apex Redirect
Two DNS records, free SSL, no account. Your naked domain forwards to your Netlify site in under five minutes.
Get Started NowQuestions? Email [email protected]