Blog · WebJi® India

WWW vs Non-WWW: Which Should You Choose?

Quick answer: WWW vs non-WWW is a hostname choice, not a ranking boost. Pick one host, serve the site only there, and 301 the other host to it so links and crawlers do not split. Google treats the two hosts as different sites when both return pages. Set the same host in WordPress and in Search Console.
✓ In business since 2005✓ INR + GST billing✓ 24/7 Email Support — avg reply < 60 min
Indian trader monitoring candlestick charts on multiple screens in evening light — www vs non www

Does WWW vs Non-WWW Affect SEO?

Neither host ranks higher because of the letters www. Google can treat https://www.example.com and https://example.com as two sites when both return pages, so links, crawl budget and reports split between them.

The fix is a canonical choice plus a 301: serve the site on one host, redirect the other to it, and use that host in the sitemap, internal links and canonical tags. An SEO engagement such as WebJi SEO checks which host is canonical before it builds links, because a second live host wastes the links already earned.

What Is the www Hostname?

www is a hostname on your domain, the same kind of label as shop or mail, and it usually points at the same server as the bare domain. It has nothing to do with HTTPS: you can serve https on both names and still have to pick one public host.

Browsers hide www in the address bar, so visitors rarely notice which one they opened. The server and the crawler still see two names when both answer.

Indian trader monitoring candlestick charts on multiple screens in evening light — www vs non www

Which Host Should You Pick, and Which Way Does the 301 Go?

Pick one host and 301 every other variant to it, never the reverse and never a 302. For a new business site on shared hosting, use the bare domain: example.com, with www.example.com redirecting to it. It is shorter, matches how people say the name, and needs only an A record.

Choose www instead when a CDN or app platform sits in front, where a CNAME at www is simple and the apex needs ALIAS or CNAME flattening, or when the site has several subdomains and you want cookies scoped to the website host alone.

  1. Write down the host you want printed on the business card. Either is fine, but decide once.
  2. Serve the real site only on that host, with a valid certificate covering both names.
  3. 301 the other host to it, keeping the path and query string, in a single hop.
  4. Use the same host in the sitemap, internal links, canonical tags and social profiles.

Set the Host in WordPress and .htaccess

In Settings, then General, both URL fields must use the chosen host. If one field has www and the other does not, WordPress redirects in a loop once the server redirect is added.

On Apache, a redirect from www to the bare host looks like this, with your domain in place of example.com:

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

Swap the host names to force www instead. On Nginx the same job is a server block for the unused host that returns a 301 with the path appended. Test in a private window. The HTTP to HTTPS guide covers the protocol half of the same change, and a full domain move is the domain walkthrough.

How Do You Tell Search Console Which Host You Chose?

Add the property that matches your choice, then submit a sitemap that uses that host. A Domain property covers both hosts and every subdomain, which is useful for watching the redirect; a URL-prefix property covers only the host you typed.

Once the 301 has been live, Page indexing should report the unused host as "Page with redirect" rather than a second set of indexed pages. There is no preferred-domain setting to flip any more: the redirect and the canonical tag do the work.

What Do Cookies Have to Do With WWW?

A cookie set with Domain=.example.com is sent to www.example.com and to every other subdomain. A host-only cookie set on www.example.com is not sent to the bare domain. That one rule decides how sessions behave when you switch hosts.

On the bare domain, your login cookie also travels to mail.example.com and static.example.com, which exposes it to anything hosted on those names and adds bytes to every asset request. On www, the cookie stays on the website host, which is why large sites and CDN users prefer it.

If you switch an existing site from www to the apex, expect one round of logged-out users: the old host-only session cookie does not follow them. Warn the client, or set the cookie domain deliberately instead of leaving it to the browser default.

When Is www the Easier DNS Choice?

www is a hostname, so a CNAME to a host or a CDN is allowed. The bare domain, the apex, often cannot be a CNAME: it needs an A record, or an ALIAS or ANAME record if your DNS host offers one.

Pick www when you need that CNAME flexibility, or when cookies on www should stay off other hostnames. Pick the apex when you want the shorter name and your DNS host can point it where the site lives. Then 301 the one you did not pick.

Frequently Asked Questions

Which is better for SEO, www or non-www?

Neither ranks higher. What matters is that one host serves the site and the other 301s to it, so links, crawl budget and reports land on a single URL.

Does choosing www or non-www affect Google rankings?

No. Two live hosts can compete with each other and split the links you already have. One canonical host with a 301 from the other removes that risk.

How do I redirect www to non-www, or the reverse?

Set both WordPress URL fields to the chosen host, add a 301 at the server from the other host to it, keep the path and query string, then test in a private window.

Why do www and non-www show different websites?

They are different hostnames. If each points at different files, or one is an old account, you see two sites. Point both at the same document root and redirect one.

Which version should my WordPress site use?

Either, decided once. Both Settings and General fields must match the chosen host, or the server redirect creates a loop as soon as it is switched on.

How do I set the preferred host in Search Console?

Add a Domain property to cover both hosts, or a URL-prefix property for one, and submit a sitemap that uses the canonical host. There is no preferred-domain toggle.

Do cookies work across www and non-www?

Only if the cookie sets Domain=.example.com. A host-only cookie on www is not sent to the bare domain, so switching hosts logs those sessions out once.

Does HTTPS fix the www choice?

No. HTTPS is the protocol and www is the hostname. You need a certificate that covers both names and one canonical host either way.

Need help with this?

WebJi® support does it for you — free. Talk to our Jaipur team →