Black Friday: 60% off yearly plans with code BF2026, until November 30. See the deal

Troubleshooting

www works but root domain does not (and the reverse)

When www.example.com loads but example.com does not, the apex (root) domain has no A or AAAA record, or the redirect from apex to www is missing. The two names are separate DNS entries, so each needs its own record. The reverse case is a missing www record.

The short answer
  • example.com and www.example.com are different names with separate records.
  • A CNAME cannot share a name with other data, which is why apex CNAMEs break mail and NS records.
  • Decide one canonical name and redirect the other with an HTTP redirect.
Try the dns lookupFree, live, no signup

Which symptom means which fault?

Apex vs www diagnosis
SymptomLikely causeFix
www loads, apex gives DNS errorNo A or AAAA record at the apexAdd an apex address record
Apex loads, www gives DNS errorNo www recordAdd a www A, AAAA or CNAME record
Both resolve, apex shows a different site or an error pageServer does not serve both hostnamesAdd the apex as a server alias or redirect
Apex CNAME rejected or breaks emailCNAME at the zone apexUse an address record, or ALIAS/flattening if your DNS host supports it

What does a correct setup look like?

Zone file for example.com (documentation addresses)
example.com.        3600  IN  A      203.0.113.10
www.example.com.    3600  IN  CNAME  example.com.

; or point www at a provider hostname
www.example.com.    3600  IN  CNAME  sites.hosting-provider.example.

Verify with dig example.com A +short and dig www.example.com +short.

Why can't you put a CNAME on the root domain?

CNAME must be alone

RFC 1034 says a node with a CNAME should carry no other data, but the apex must also hold SOA and NS records.

It breaks mail

Other records at the apex, such as MX and TXT, would conflict with a CNAME there.

Workarounds exist

Some DNS hosts offer CNAME flattening or an ALIAS record that answers with the target's address instead. Cloudflare documents its flattening.

Flattening returns an address at the apex instead of a CNAME, per Cloudflare's documentation. Names and support vary by DNS host.

Pick one canonical hostname

Make both names resolve, then redirect one to the other with an HTTP 301 so search engines and visitors see a single address. Check that the TLS certificate covers both names, or the redirect itself will show a certificate warning.

How do you fix it, in order?

  1. 01

    Look up both names

    Run dig example.com A +short and dig www.example.com A +short. The one with no answer is missing a record.

  2. 02

    Add the missing record at your DNS host

    Use the DNS host your nameservers point to, not necessarily your registrar.

  3. 03

    Make the web server answer both hostnames

    The server or hosting dashboard must list the apex and www as accepted names.

  4. 04

    Add a redirect

    Send one hostname to the other with a 301 so there is one canonical address.

  5. 05

    Check the certificate

    Both names must be covered by the TLS certificate, or the redirect shows a warning.

Good to know

This split is common on new sites because the two names are set up separately. Some hosts offer a built-in redirect from the apex to www that has to be switched on.

Check both the DNS record and the redirect setting, since either one missing gives the same symptom.

Common questions

Why does www.example.com work but example.com not?

They are two separate DNS names. Setting up www does not create anything for the bare domain. Add an A or AAAA record at the apex, and make your web server answer for that hostname or redirect it to www.

Can I put a CNAME record on my root domain?

Standard DNS does not allow it, because a CNAME must not coexist with other data and the apex always has SOA and NS records. Some DNS hosts provide an ALIAS or CNAME flattening feature that works around this.

Why does my CNAME conflict with other records?

A name with a CNAME must have no other records, per RFC 1034. Adding an MX, TXT or A record at the same name as a CNAME is invalid. Many DNS hosts reject it. Move the CNAME to a subdomain or remove the other records.

Should the site use www or the bare domain?

Either works. Pick one, serve it as the canonical address and 301 redirect the other. Consistency matters more than the choice, and both hostnames need valid DNS and a matching certificate.

Watch your domains automatically

Aepto monitors expiry, DNS, SSL and uptime for every domain you own and alerts you when something changes. Free for 3 domains.