17 October 2026

www vs apex without a clear preference

www.example.com and example.com are two documents while both return 200. Pick one host, 301 the rest, and keep canonical only as a safety net.

www.example.com and example.com are two hosts to a crawler, not spellings of one URL. While both hostnames return status 200, the same HTML becomes two documents. Backlinks, nav links, and sitemap rows that use the other host feed the second copy. Ranking signals split across two addresses, and Search Console may show one host indexed while campaigns share the other.

Picking www or the apex (the bare hostname) matters less than picking one. Certificates, cookie scope, and mail records sometimes push toward apex; www is a subdomain that many stacks still treat as the public site. What matters is that origin, CDN, sitemap, hreflang, and internal links all use the same host. The mix starts when DNS resolves both names and the origin treats both as valid.

Canonical is not the host switch

A rel=canonical that points at www while the apex still returns 200 is only a hint. Google may ignore it when the sitemap or internal links keep naming the other host. Canonical helps as a safety net for copies you cannot redirect, not as a substitute for a server rule on the hostname pair. A 301 from each URL on the rejected host to the same path on the chosen host makes the preference enforceable. Crawlers follow Location, browsers cache it, and signals land on one hostname. Redirecting only the homepage while deeper paths still 200 on both hosts leaves the duplicate in place.

The leak shows up in ordinary places: an absolute menu link to the apex, a sitemap generator that reads APP_URL without www, an hreflang block that pairs English on www with Dutch on the apex, or a CDN that serves both certificates without redirecting. Print templates, email signatures, and ad URLs repeat the mismatch.

Put the 301 on the origin or load balancer for the whole hostname pair, not only in HTML. After that the sitemap should list only the preferred host. The note on trailing slash covers path variants on one host; this case is two hosts. Canonical tags still apply to copies you cannot redirect. A crawl that opens both hostnames and records Location shows the pattern: two 200s is the defect, one 301 plus one 200 is the repair.

Frequently asked questions

No. While both hostnames return status 200, they are two documents. Pick one host and 301 the other to that preferred URL.

No. Canonical is a hint. While both hosts return 200, Google may ignore it. A 301 makes the preference enforceable.

On the origin or load balancer, for every URL on the rejected hostname, not only the homepage. A tag in HTML is too late and too incomplete.

Want this on your site today?

First report free. Then auto-scan, a PDF in your inbox and alerts when a score drops.

Start a free report
Start free