Site works with www but not without it? Add both domains and a redirect

Ship ItChecked against the official source

The short answer

To DNS, yoursite.com and www.yoursite.com are two different names, and each one needs its own record. Vercel's docs: "The DNS spec forbids using CNAME records on apex domains like example.com". So on Vercel the root domain gets an A record, and a subdomain like www gets a CNAME record. If only one of them works, Vercel's fix is to add both domains to the project and redirect one to the other.

What to do

  1. In your DNS, give the root domain an A record and www a CNAME record, using the values Vercel shows for your project.
  2. Add both domains to your Vercel project and configure a redirect to your preferred domain (Settings, Domains, Redirect to).
  3. Open your site with and without www, and check that both reach it.
  4. Ask your AI tool: "Check my domain setup: which DNS records do the root domain and the www subdomain need for my host, and which one should redirect to the other?"

Good to know

  • Either one can be your preferred domain. Vercel recommends www, but using the root domain as primary works too.
  • If your DNS is on Cloudflare, CNAME flattening allows a CNAME record at the root of your domain (the zone apex).

Source

Checked on 10 Oct 2026. Prices, limits and settings change, so check the source before you rely on them.

Related