www not working, but the domain without www does (or the other way around)

Updated Oct 27, 2026 · Pewterkit Guides

When yourapp.com works but www.yourapp.com shows "site can't be reached" (or the reverse), the missing name has no DNS record pointing at your host. Add both names to your hosting project, create the DNS record your host asks for (usually a CNAME for www and an A record for the bare domain), and set one to redirect to the other.

Why one works and the other doesn't

yourapp.com and www.yourapp.com are two different names in DNS. Setting up one doesn't create the other. Vercel's troubleshooting table lists this exact symptom, "The apex domain works but www does not, or the reverse", with the fix: "Add both domains to the project and configure a redirect to your preferred domain."

Fix it

  1. Add the missing name to your hosting project (for example, Vercel: Settings > Domains > Add Domain). Vercel: "If you add an apex domain (e.g. example.com) to the project, Vercel will prompt you to add the www subdomain prefix."
  2. Create the DNS record your host shows for it. On Vercel, apex domains use an A record and subdomains such as www use a CNAME record; use the exact values your project's Domains page shows. Vercel: "The DNS spec forbids using CNAME records on apex domains like example.com", which is why the two names use different record types.
  3. Pick a main address and redirect the other to it. Vercel recommends "using the www subdomain as your primary domain, with a redirect from the non-www domain to it," though either direction works.
  4. Wait for DNS, then try both names in a private window.

Confirm it

dig +short yourapp.com
dig +short www.yourapp.com

Both should return an answer (an IP address or a CNAME target). Then open both in the browser: one shows your site, the other redirects to it.

What Pewterkit Check looks at

For an app on its own domain, served from the bare domain or from www, the check looks up A, AAAA and CNAME records for the other name and warns when it doesn't resolve, so people who type it get an error page. Apps on a subdomain such as app.yourdomain.com are left out, because www isn't their address. A DNS lookup that fails never becomes a finding.

FAQ

Should my main address be www or the bare domain?

Either works as long as the other redirects to it. Vercel recommends www as the primary for its network; many sites use the bare domain.

I added the DNS record but www still fails. Why?

The name must also be added to your hosting project, or the host doesn't know which site to serve for it, and DNS changes can take time to spread.

Does it matter for search?

A redirect from one name to the other keeps one main address, so links to either name end up on the same pages.

Sources

  1. Adding & configuring a custom domain (Vercel Docs) — read 27 Oct 2026
  2. Deploying & redirecting domains: redirecting www domains (Vercel Docs) — read 27 Oct 2026

How this page was made: drafted with AI from the sources listed, reviewed by Pewterkit. Docs checked Oct 27, 2026. Spotted something out of date? Tell us.

Related guides