Skip to content

www or no www: picking one and redirecting the other

Updated 16 November 2026

Why do I have two versions of my address?

The www is a short label added in front of the domain name. So example.com and www.example.com are, strictly, different addresses. Many sites answer to both.

MDN describes the usual case. A site lives at www.example.com, but opening it from example.com should also work, so a redirect is set up from one to the other1. It adds that you might also redirect common synonyms or frequent typos of your domain1.

It isn't a fault if both load. It's just untidy, and untidy has a cost.

What's wrong with leaving both working?

You end up with two addresses for every page. MDN says that, ideally, there is one location, and therefore one URL, for each resource1.

Google's advice points the same way. If people can reach your home page in several ways, it's a good idea to pick one of those addresses as your preferred (canonical) destination. Then use redirects to send traffic from the others to the preferred one2. Google's own example list includes https://www.example.com as one of the possible forms2.

Two addresses, one preferredVisitor types the other versionServer sends a permanent redirectBrowser loads your chosen version
The other address redirects to the one you chose.

Which one should I pick?

Either. The sources here don't say one beats the other, and this site won't invent a ranking. What matters is picking one and sticking to it.

A few things can help you choose. Check what your host or platform sets up by default, since fighting the default can mean more work. Look at which version your existing links and printed material already use. Then follow your platform's own help pages, because some handle one version more simply than the other.

Whatever you choose, use it everywhere: in your links, in your sitemap, and in anything you publish.

How do I redirect the other one?

You create a permanent redirect from the version you're not using to the one you are. That fits Google's rule for permanent redirects: you're confident you won't reverse it2. Which code to ask for is covered under redirect types.

How you do it depends on your set-up. Many hosting and platform dashboards have a setting for a preferred version. Use that if you have it, and follow the maker's documentation for the details.

On a server you control, MDN shows how it looks in its guide. For Nginx, a separate server block holds the redirect for the version you're moving away from. For Apache, the Redirect directive in a virtual host does the job1. Copy the pattern from the maker's own manual for your version, not from a forum post.

Keep the rule simple. One rule that goes straight to the final address is better than a rule that bounces through two others. See redirect chains and loops.

Should I combine this with the http to https redirect?

You'll usually have both. The trap is doing them as two separate steps, so that a visitor typing http://example.com goes first to https://example.com and then on to https://www.example.com. That's a chain of two hops where one would do.

Aim to send each variant straight to the final version. The secure half of the job is in redirecting http to https. After setting both up, test all four combinations: with and without www, each on http and https.

Do I tell Google about the change?

Not for this. Google's site-move guide says its Change of Address tool is only needed when moving from one domain or subdomain to another. It says you don't need it for switching between www and non-www on the same domain3.

How do I know it worked?

Test it. Google's guide to moving sites simply says to test the redirects3. Type each version of your address into a browser and see where you end up. A longer method is on the page about checking redirects.

If a version fails to load at all, the redirect has nothing to work with. Check your host's documentation for how to make both versions reach your site first.

If you see a "too many redirects" message, two rules are probably sending visitors back and forth. Cut back the number of rules first. MDN's view is that redirects should be kept to a minimum1.

Setting it upPick one versionRedirect the other to itUpdate your own linksTest both versions
Choose once, then test both versions.

Further reading and sources

  1. Redirections in HTTP, MDN Web Docs (Mozilla)
  2. Redirects and Google Search, Google Search Central
  3. Site moves with URL changes, Google Search Central