I often get asked:
Steve, should my new site use www or no www for SEO?
The choice seems simple, should your site have a www:
or no www:
But, does it impact SEO? It does if you use both www and not www inconsistently in your links.
So pick one and stick to it.
I recommend that you do not use www on any new site. On an existing site you should look to see what is currently more popular by checking Google Search Console.
Which ever option you choose there are a few technical tasks you need to do to make sure that your site is ready.
Let's dive into what these technical tasks are.
Why you should not use WWW
WWW stands for World Wide Web and is a throwback to the early days of the web.
WWW points a URL to the web server that hosts your site.
Today, we know that most sites have their main website at www. So Google decided to remove the www when you type it into the address bar.
From Chrome 76 when you type a URL with www at the beginning it will remove the www and only show the domain.
This is their
reason for removing:
To make URLs easier to read and understand, and to remove distractions from the registrable domain, we will hide URL components that are irrelevant to most Chrome users. We plan to hide “https” scheme and special-case subdomain “www” in Chrome
You can take this as a clear sign that www is being phased out by Google.
As I mentioned before for SEO the best thing you can do is be consistent. You do not want to mix www or no www for SEO. Mixing the two will cause SEO issues.
For example, Google will see these two URLs as separate pages:
Even though they are the same page. So it will split link juice across these different URLs unless you tell Google what the preferred URL is.
There are a few things you need to set up to make sure that Google knows which is your preferred URL.
Use a canonical - This tells Google what the preferred URL is.
Use non-www links in your sitemap - All the links in your sitemap should use the same format.
301 redirect www to non-www or use your DNS setup - Any www link should 301 redirect to the non-www URL.
Let's have a look at how we can set this up in more detail.
Use a Canonical
What is a canonical URL?
This is either a link tag in the HTML of the page or a HTTP header returned from your web server.
Use this to tell Google your preferred URL. As we said earlier these two URLs are the same page:
Yet, Google sees them as two separate pages.
The job of the canonical is to tell Google that these two links are the same page.
Let's look at an example.
Say we run the website
example.com and we have decided to not use the www prefix.
We can add a Canonical Link tag to the HTML like this:
< link rel = "canonical" href = "https://example.com/" />
Both of these URLs would return the above HTML:
Letting Google know that we prefer the URL
https://example.com/. So even if Google comes to the site using
https://www.example.com/ it knows that the page is actually
When you have set up canonical link tags it is normal to get links to your site from another site with the www in the URL. Adding the canonical will stop both links from appearing in Google Search.
Google will then combine link juice for both of these URLs giving you an SEO boost.
As well as the HTML canonical link tag you can also use a HTTP header.
The HTTP header returned would be:
HTTP/1.1 200 OK
https: / / example . com/>; rel="canonical"
You only need to use one of these methods. Either HTML or HTTP. There is no preference on which one you choose, use the one that makes the most sense for your set up.
For what it is worth, it is more common to see the HTML tag in my experience.
It is also important to have consistency in your sitemap URLs.
The sitemap that you use and submit to Google Search Console should use non-www in the URLs.
Once you have
found your sitemap you can check that the URLs are the same.
If the sitemap is an XML file then your sitemap would look something like this:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns= "http://www.sitemaps.org/schemas/sitemap/0.9" >
<loc >https://example.com/ </loc>
<lastmod >2018-06-04 </lastmod>
You can do a find on the sitemap page for www if you find any links with the www prefix, fix them. Once you have fixed the links resubmit the sitemap to Google Search Console.
301 Redirects and DNS Set up
What happens if someone does type www into the address bar. Your web server needs to redirect the user to the non-www URL.
For example, if a user typed this address into the browser:
We would want this to point to your web server. Once the web server receives this request it would then redirect the user to:
You can see this on action on PageDart. If you type
https://www.pagedart.com into your address bar the web server will redirect to the non-www.
Let's look at Google Chrome Developer Tools and the network tab. When we load
https://www.pagedart.com is being redirected with a 301 to
301 redirect is a permanent redirect. It tells the browser that we want www links to permanently redirect to non-www.
Let's look at setting this up.
The first thing you need to do is configure your DNS so that both the www and non-www links point to the same web server. Here is an example of how pagedart.com is configured:
The above config means that both the www and non-www URLs are pointing at the same web server.
So regardless of which one a user types into the address bar of a browser, the request will reach my web server.
The next step is to configure the web server to redirect if the request contains a www.
To do this will depend on the web server you are using but here are a few configurations for popular servers:
For NGinX you would add config like this:
return 301 $scheme://example.com$request_uri;
For Apache you would use this configuration:
VirtualHost * :80>
Redirect permanent / http://example.com/
< VirtualHost * :80>
# real server configuration
Once you have the DNS and the redirect set up all your URLs would redirect from www to non-www.
Preferred Domain Setting Removed
Before we finish up there is one more piece of advice that I want to touch on.
On many blogs you may see that you can go into Google Search Console and set your preferred domain:
This was removed by Google in June 2019.
Their advice is to use the canonical link or HTTP header as we have discussed above. So there is no need to worry about this setting anymore.
Just set up your website using the steps above and Google will know what to do.
Final Thoughts, WWW or No WWW for SEO
When setting up a new site you need to choose between www or no www for SEO. When dealing with SEO you must be consistent when you choose one.
If you are inconsistent then you are going to split the link juice between the URLs.
We can see that Google is starting to phase out the use of www. It is no longer going to show www in the Google Chrome Browser.
So you should not use www anymore when setting up a new site.
Once you have decided to not use the www you need to set up your website so that it always uses these URLs.
To do this there are 3 steps:
Use a canonical
Use non-www links in your sitemap
301 redirect www to non-www or use your DNS setup
Once you have set these settings Google will know which URL it should use for all URLs.