Preferences

Privacy is important to us, so you have the option of disabling certain types of storage that may not be necessary for the basic functioning of the website. Blocking categories may impact your experience on the website. More information (Cookie Policy)

WWW vs Non-WWW: Which Version to Choose and How to Redirect the Other

WWW vs non-WWW: pick one version of your site, use it everywhere, and redirect the other with a 301 so Google sees one site, not two.

Sorank customerSorank customerThomas Girauc, Sorank customerCelio Fabiano, Sorank customerSorank customerXavier Breull, Sorank customer
+ 9'000 Subscribers
WWW vs Non-WWW: Which Version to Choose and How to Redirect the Other
Notification: your site reached 20K clicks from Google Search in 28 days

Tools

On this page

Summary

WWW vs non-WWW is the choice between two addresses for the same site, such as www.example.com and example.com. Search engines can treat them as two separate sites, so you pick one version, use it everywhere, and redirect the other to it with a 301 redirect or a canonical tag.

Want to go further? Ask

WWW vs non-WWW is about the hostname, the part of the address in front of your domain name. The www label is a subdomain by convention, and nothing requires it. Both addresses can load the same page, but a browser and a search engine read them as two different addresses. Your job is to pick one and send every other version to it.

What is the difference between www and non-www?

The only difference is the hostname. www.example.com has a www label in front of the domain, and example.com does not. Many sites were built with www in the past, and many new sites drop it, so you will see both on the web.

Does Google treat www and non-www as the same site?

Not always. Google indexes each URL, and the two hostnames are different. If both versions load and nothing says which one is the main one, Google may index both or pick one for you. Google describes a redirect as a strong signal that its target should become the canonical version, so a redirect is the clearest way to tell it which one you want.

Google Search Central guide on consolidating duplicate URLs, which explains how to choose one preferred URL
Screenshot of developers.google.com

Should you keep www in your domain?

Keep the version you already use if your links and history point to it. If you start fresh, you can drop www for a shorter address. Either choice can rank. What matters is that one version wins everywhere.

QuestionKeep wwwDrop www
Existing linksMost links may already point to www, so nothing movesEach www link needs a redirect to keep its value
Address lengthLonger to type and printShorter on cards, ads and packaging
Setup workRedirect the bare domain to wwwRedirect www to the bare domain and update your site settings

Whichever you choose, check that your email, your app and your other services use the same address.

How do you redirect the other version?

Set a permanent 301 redirect from the version you did not choose to the one you did. Google's redirect guide says that a 301 or 308 means a page has permanently moved to a new location, and it advises picking one URL as the preferred one and redirecting the others to it. Read the 301 and 302 redirects compared page before you choose a code, because a 302 says the move is temporary.

On an Apache server, a rule in the .htaccess file does the job. Replace example.com with your domain:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]

Most hosts, site builders and CMS tools also have a primary domain setting. Use it when you can, because it writes the redirect for you. If you cannot redirect, a canonical tag tells search engines which URL is the main copy. It does not move visitors, so use it only when both versions must load. Put one in the head of each page, pointing to your chosen address:

<link rel="canonical" href="https://example.com/pricing">

Tip

Change the primary domain setting first, then add the redirect. Test both addresses after each change, so you can catch a loop where each version sends visitors to the other.

How can you check which version your site uses?

Type both addresses into a browser. Each one should end on the same final address. Then follow the chain one hop at a time with Sorank's free redirect checker, which shows each status code and whether the chain loops. Sorank's free canonical tag checker shows where a page's canonical points.

Free redirect checker tool that follows the redirect chain of a URL, hop by hop
Screenshot of sorank.com

Check your home page and at least three inner pages. A redirect that works on the home page can still leave an old blog post on the other version. If you want the wider picture, read about duplicate content too.

Does www vs non-www affect rankings and cookies?

When the choice is consistent, the direct effect on rankings is small. The real cost comes from split signals. If some links point to www and others to the bare domain, the links and the page history are divided between two addresses. One version gathers them in one place.

Cookies are a second reason. A cookie follows the hostname that set it. MDN explains that when a cookie has no Domain attribute, it is available on the server that set it but not on its subdomains. If your login cookie is set on www.example.com, a visitor who lands on example.com does not send it and looks logged out. Keep one version for the whole site, so login, cart and analytics stay with one address.

Brand image matters too. An address that shows www in one place and the bare domain in another looks less consistent, and people will type the one they remember.

Common www and non-www mistakes

These mistakes keep two versions alive. Here is how to spot each one and how to fix it.

  1. Both versions load with a 200 status. The same page answers on two addresses. To spot it, type both addresses and compare the final URL. To fix it, add a 301 redirect from the version you did not choose.
  2. Redirect chains. A visitor goes through two or three hops, for example from http to www and then to https. To spot it, a redirect checker shows more than one hop. To fix it, send each old address straight to the final one.
  3. The sitemap lists the other version. The file asks search engines to crawl an address you do not use. To spot it, open the sitemap and read the first URLs. To fix it, list only your chosen version and resubmit the sitemap.
  4. Internal links use both versions. Menus or articles link to www in some places and to the bare domain in others. To spot it, crawl the site and count both hostnames. To fix it, update the links in your templates and content.
  5. Canonical tags point to the other version. A page says its main copy is the address you did not choose. To spot it, check each page's canonical with a checker. To fix it, point every canonical to your chosen address.

Why does www vs non-www matter for SEO and GEO?

For SEO, one address keeps links, rankings and page history in one place. For GEO, the AIs cite the URLs they find. If your pages and the sources that mention you use both versions, the mentions split across two addresses. Pick one version, so every link, citation and cookie leads to the same site. Read how Google picks the canonical URL when several candidates exist.

Conclusion

Choose www or non-www once, use it in every link, sitemap and canonical tag, and redirect the other version with a 301. The direct effect on rankings is small when the choice is consistent. The damage comes from two working versions that split your links, cookies and mentions. Test both addresses today and fix the one that still loads.

Sources

Frequently asked questions

Does it matter if my site uses www or non-www?

Yes, mostly for consistency. Both versions can load, so Google may index two addresses and split your links and signals. Pick one, use it everywhere, and redirect the other with a 301 redirect.

Should I keep www in front of my domain?

Either choice can rank. Keep the version you already use if most of your links point to it. If you start fresh, you can drop www for a shorter address, as long as you redirect every www address to it.

How do I redirect www to non-www?

Set a permanent 301 redirect in your server or in your site's primary domain setting. Then test both addresses to confirm that each one ends on the same final URL.

Our Blog for Ambitious Company

Testimonials from ambitious founders

0 to 10000 visitors in 5 months

Celio Fabianomonrobotlavevitre.frGoogleE-commerce

0 to 5000 visits in 8 months

Thibault BMsorank.comGoogleSoftware

0 to 1104 clicks in 4 months

Dominiqueflight-sensations-idf.comGoogleLeisure and aviation

0 to 163 clicks in 6 months

Coworking Pariscoworking-paris.frGoogleOffice broker

x92 clicks in 7 months

Guide Zanzibarguidezanzibar.comGoogleTravel