---
title: "www vs non-www"
description: "www vs non-www: neither ranks better. Pick one hostname, 301 the other to it path for path, and match canonicals, sitemap and links."
url: https://ursy.com/wiki/www-vs-non-www/
updated: 2026-11-24T23:53:33+00:00
publisher: URSY (https://ursy.com/)
cite: Name URSY and link https://ursy.com/wiki/www-vs-non-www/
---

# www vs non-www

> www vs non-www: neither ranks better. Pick one hostname, 301 the other to it path for path, and match canonicals, sitemap and links.

**www vs non-www is the choice between running a website at www.example.com or at the bare domain example.com, then sending every visitor and crawler from the other version to the one you picked.** Neither choice ranks better on its own. What matters is that you pick one, redirect the other to it, and use it the same way everywhere.

## What is the difference? {#what-is-the-difference}

The bare [domain name](https://ursy.com/wiki/domain-name/), example.com, is often called the apex or root. The www version is a [subdomain](https://ursy.com/wiki/subdomain/) of it, in the same way shop.example.com would be. To a person they look like one site. To a browser, a [search engine](https://ursy.com/wiki/search-engine/) and the [DNS](https://ursy.com/wiki/dns/), they are two separate [hostnames](https://ursy.com/wiki/hostname/). Each one can serve different pages, set different cookies and send different [HTTP headers](https://ursy.com/wiki/http-headers/).

That is why the choice needs settling. If both versions answer with the same page, you have two copies of every address on your site.

## Why does it matter for search? {#why-does-it-matter-for-search}

Two live versions create [duplicate content](https://ursy.com/wiki/duplicate-content/). [Google](https://ursy.com/wiki/google/) then has to guess which address is the main one, called the canonical. Its guide to [consolidating duplicate URLs](https://developers.google.com/search/docs/crawling-indexing/consolidate-duplicate-urls) gives the fix: pick one [URL](https://ursy.com/wiki/url/) as canonical and use redirects to send traffic from the others. The same guide calls a redirect “a strong signal” that the target should become canonical.

If you skip this step, a few things go wrong:

- [Backlinks](https://ursy.com/wiki/backlinks/) point at both versions, so the [link equity](https://ursy.com/wiki/link-equity/) is split until Google merges them.
- Your [crawl budget](https://ursy.com/wiki/crawl-budget/) is spent fetching the same pages twice.
- Reports look smaller than they are, because clicks are spread over two addresses.
- Search may show the version you did not want, with an odd-looking address in the results.

Google merges duplicates well, but it is still guessing. A clear redirect removes the guess.

## Why does it matter for AI answers? {#why-does-it-matter-for-ai-answers}

[AI assistants](https://ursy.com/wiki/ai-assistant/) and their crawlers fetch pages the same way [search crawlers](https://ursy.com/wiki/search-crawler/) do. An [AI crawler](https://ursy.com/wiki/ai-crawler/) that meets two versions may store both, or quote the one you did not intend. When an assistant writes a [citation](https://ursy.com/wiki/citation/), a clean single address makes the link back to you more likely to work and to match your other mentions. Consistent addresses also help a machine treat your site as one [entity](https://ursy.com/wiki/entity/) rather than two. That is a small but real part of [answer engine optimisation](https://ursy.com/wiki/answer-engine-optimisation/).

## Which one should I choose? {#which-one-should-i-choose}

Either is fine for ranking. Pick based on the technical points below, then stick with it for years.

| Point | www.example.com | example.com |
| --- | --- | --- |
| DNS | Can be a CNAME record pointing at a CDN or platform | Usually needs A or AAAA records, or a provider feature that flattens a CNAME |
| Cookies | Easy to keep cookies away from other subdomains | Cookies set for the whole domain reach every subdomain |
| Looks | Longer, familiar to older users | Shorter, cleaner on print and social posts |
| Ranking | No built-in advantage | No built-in advantage |

### The DNS point {#the-dns-point}

The internet standard [RFC 1912](https://www.rfc-editor.org/rfc/rfc1912) says, in section 2.4, that a CNAME record “is not allowed to coexist with any other data”. The apex of a domain must hold its NS and SOA records, so a plain CNAME cannot sit there. A www name has no such limit. That is why many [CDN](https://ursy.com/wiki/cdn/) and cloud services find www simpler to point at their servers. You can check your own records with our [DNS lookup](https://ursy.com/webmaster-tools/dns-lookup/).

### The cookie point {#the-cookie-point}

MDN’s page on [Set-Cookie](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Set-Cookie) explains that setting the Domain attribute makes a [cookie](https://ursy.com/wiki/cookie/) available to that domain and all its subdomains. If you leave it out, the cookie is host-only. Sites on the bare domain often set cookies for the whole domain, so those cookies travel to every subdomain too. Sites on www can keep cookies tighter. Our [cookie checker](https://ursy.com/cookie-checker/) shows which cookies a page sets.

## How does the redirect work? {#how-does-the-redirect-work}

The version you did not pick should answer every request with a permanent [redirect](https://ursy.com/wiki/redirect/), a 301 or 308, to the same path on the chosen version. So http://example.com/shop/ should land on https://www.example.com/shop/ in one hop, not on the home page. Our page on [301 vs 302 redirects](https://ursy.com/wiki/301-vs-302-redirect/) explains why a permanent code is right here.

Then line up every other signal behind the same choice:

1. Every [canonical tag](https://ursy.com/wiki/canonical-tag/) uses the chosen hostname.
2. Your [XML sitemap](https://ursy.com/wiki/xml-sitemap/) lists only chosen-version addresses. Google’s guide says every URL in a sitemap is a suggested canonical.
3. [Internal links](https://ursy.com/wiki/internal-linking/) point at the chosen version. Google advises linking to the canonical URL rather than a duplicate.
4. Your [Open Graph](https://ursy.com/wiki/open-graph/) tags and structured data use it too.

## What about HTTPS and HSTS? {#what-about-https-and-hsts}

Settle www and HTTPS together, so that every old version reaches the final address in one step. Google’s guide says it prefers HTTPS pages over [HTTP](https://ursy.com/wiki/http/) ones as canonical. Our page on [HTTPS vs HTTP](https://ursy.com/wiki/https-vs-http/) covers the wider reasons.

If you use the Strict-Transport-Security header, MDN’s [HSTS reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Strict-Transport-Security) says the header must not be sent on the plain HTTP redirect, only on the HTTPS response. It also notes that a browser may reach www.example.com without ever visiting example.com, so the www host should send its own HSTS header. Our [security headers checker](https://ursy.com/security-headers-checker/) shows what each version sends.

## Common mistakes {#common-mistakes}

- **Both versions return 200.**  No redirect at all, so every page exists twice.
- **Redirect to the home page.**  Every old address lands on / instead of its own page, which loses the match.
- **Chains.**  http://example.com goes to https://example.com, then to https://www.example.com. That is a [redirect chain](https://ursy.com/wiki/redirect-chain/). Make it one hop.
- **Mixed signals.**  The redirect says www, but the canonical tags and sitemap say non-www.
- **A missing certificate.**  The [SSL certificate](https://ursy.com/wiki/ssl-certificate/) covers only one name, so https on the other version shows a browser warning before the redirect can run.
- **Using the change of address tool.**  Google’s help page on the [Change of Address tool](https://support.google.com/webmasters/answer/9370220) says that for a move between www and non-www on the same domain you should use canonical tags and redirects, not that tool.

## A worked example {#a-worked-example}

A small online shop runs on example.co.uk. Both example.co.uk and www.example.co.uk show the full site, and both work over http and https. That is 4 versions of every page.

The owner picks https://www.example.co.uk because the shop platform asks for a CNAME. They set a 301 from the other 3 versions, path for path. They check the certificate covers both names. They update the canonical tags, rebuild the sitemap and fix the menu links that still pointed at the bare domain. They add a Domain property in [Google Search Console](https://ursy.com/wiki/google-search-console/) and watch the [page indexing report](https://ursy.com/wiki/page-indexing-report-index-coverage/). Over the next weeks the “duplicate” rows shrink and clicks gather on one hostname.

## How to check it {#how-to-check-it}

1. Type all 4 versions (http and https, with and without www) into our [redirect checker](https://ursy.com/redirect-checker/). Each should reach the chosen address in 1 hop with a 301 or 308.
2. Run a page through our [canonical checker](https://ursy.com/canonical-checker/) to confirm the canonical tag matches.
3. Run your sitemap through our [sitemap checker](https://ursy.com/sitemap-checker/) and look for any address on the wrong hostname.
4. Use our [SSL checker](https://ursy.com/ssl-checker/) on both names.
5. Use the [HTTP header checker](https://ursy.com/http-header-checker/) to see the status code and Location header on the version you did not pick.

Google’s help page on [adding a Search Console property](https://support.google.com/webmasters/answer/34592) says a Domain property automatically includes both www and non-www, as well as http and https. It needs DNS verification. A URL-prefix property covers only the exact protocol and host you type, which makes it useful for seeing each version on its own. For a full picture, our [SEO audit](https://ursy.com/seo-audit/) looks at these signals together.

## Questions {#questions}

### Will switching from non-www to www hurt my rankings? {#will-switching-from-non-www-to-www-hurt-my-rankings}

It can cause a short wobble while Google recrawls. With path-for-path 301s and matching canonicals, the signals move across. Treat it like a small [site move](https://ursy.com/wiki/move-a-website-without-losing-traffic/).

### Do I still need the other version to work? {#do-i-still-need-the-other-version-to-work}

Yes. People type both, and old links use both. The other version must stay live, with a valid certificate, purely to redirect.

### Is www a ranking factor? {#is-www-a-ranking-factor}

No. It is a [technical SEO](https://ursy.com/wiki/technical-seo/) housekeeping choice. Consistency is what counts.

## Related words {#related-words}

- [Canonical tag](https://ursy.com/wiki/canonical-tag/)
- [Duplicate content](https://ursy.com/wiki/duplicate-content/)
- [Subdomain](https://ursy.com/wiki/subdomain/)
- [Redirect chain](https://ursy.com/wiki/redirect-chain/)
- [HTTPS vs HTTP](https://ursy.com/wiki/https-vs-http/)

## Sources {#sources}

- [Google Search Central: Consolidate duplicate URLs](https://developers.google.com/search/docs/crawling-indexing/consolidate-duplicate-urls), checked 24 November 2026
- [Google Search Console Help: Add a website property](https://support.google.com/webmasters/answer/34592), checked 24 November 2026
- [Google Search Console Help: Change of Address tool](https://support.google.com/webmasters/answer/9370220), checked 24 November 2026
- [RFC 1912: Common DNS Operational and Configuration Errors, section 2.4](https://www.rfc-editor.org/rfc/rfc1912), checked 24 November 2026
- [MDN: Set-Cookie header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Set-Cookie), checked 24 November 2026
- [MDN: Strict-Transport-Security header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Strict-Transport-Security), checked 24 November 2026

*Updated 24 November 2026 by URSY.*
