Redirect www to non-www when the root domain is your main address
www.yoursite.com and yoursite.com can show the same pages, and either one can be your main address. Pick one and send the other host there, so each page has a single address.
How do I redirect www to non-www on Cloudflare?
Match HTTPS requests to the www host and redirect them to the root domain, retaining the path and query string. Cloudflare's www-to-root example shows this with a permanent redirect. If www is your preferred host, reverse the source and destination.
Keep a www redirect and canonical tag pointed at the same host
- 1
Name the preferred page address
Set canonical tags to the chosen host and use that host in internal links.
- 2
Keep the redirect on the other host
Send each alternate-host URL to its matching page on the preferred host, rather than sending every request to the home page.
Keep HTTPS working on the host you redirect from
A browser visiting https://www.yoursite.com negotiates TLS before it receives an HTTP redirect. That source host still needs a certificate that covers its name, even if every visit then goes elsewhere. HTTP over TLS describes that order.
Frequently asked questions
Does a canonical tag replace a www to non-www redirect?
No. A canonical tag tells search engines which page address you prefer; a redirect sends the visitor to that address. Google's canonical guidance describes both signals.
Keep your preferred host aligned with HTTPS and canonical tags
Domain health
Fix the setup mistakes that make browsers warn people away from your site.
HTTP to HTTPS redirect
Send HTTP requests to their HTTPS destination and avoid conflicting redirect rules.
Canonical tags
Resolve conflicting preferred URLs and understand Google's canonical-page statuses.