One of the very first things you need to decide when setting up a new website or blog is whether to use www or no www in front of your domain. It’s a decision you need to take once in the beginning and stick to it for the lifetime of your website.
In this post, we will examine what is difference between having www in your URL and no www and what are the best practices when it comes to search engine optimization.
www vs no www
What is the technical difference between having www in your URL and not having www?
Let’s see a couple of examples:
URLs with www
URLs with no www
Domains with no www in front are also called naked domains. Domains with www can also act as a hostname which can sometimes be easier to manage when it comes to cookies, in cases where you have a number of subdomains assigned to the www domain.
This is a really technical thing which in reality won’t affect the majority of websites, so if you are having difficulties understanding what this means, just skip this explanation and move on to the big question.
Should I use www or no www in front of my domain?
The answer is simple. It depends on your personal preference. There is no SEO advantage from using one format or the other.
Three things are important:
First, to configure your website to ‘listen’ to only one of the variations (more on this below).
Second, to let Google and other search engines know what is your preferred choice.
Google considers http:// and http://www as two different websites
Why all the fuss about www and no www? Because Google considers these to be two different websites.
In other words, in the eyes of Google, http://example.com and http://www.example.com are two different websites and if you don’t specify which version you want to use, you will end up having SEO issues.
Let’s see how to set the preferred domain for your website and how to communicate your decision with Google so that you avoid and crawling and indexing issues.
How to set your preferred domain in WordPress?
Login to your WordPress dashboard and then click GENERAL and then select SETTINGS from the left menu.
In the WordPress Address (ULR) and Site Address (URL), set your preferred domain.
In the example below, I have selected my preferred domain to have the www in front. As explained above, there is no advantage from doing so, it’s just a matter of personal preference.
How to test that your preferred domain is set correctly?
To test that WordPress can successfully redirect from one version of your domain to the other, perform the following test.
Open a browser window and type http://example.com, if your preferred domain is set to http://www.example, then the page should automatically redirect to http://www.example.com.
How to set the canonical URL of your domain?
The preferred domain is also known as the canonical domain. A canonical URL, in general, is a piece of HTML code that tells search engines, what is the canonical or preferred version of the page.
Best SEO practices suggest that you have the canonical URL set for each and every page of your website.
To check if your theme sets the canonical URL correctly, open your homepage in a new browser window and then go to VIEW SOURCE (right-click anywhere on the page and select VIEW SOURCE).
Search for the word ‘canonical’ and you should see a line like this:
<link rel=”canonical” href=”https://www.reliablesoft.net/” />
This indicates the canonical URL for the page and it helps to prevent duplicate content issues.
Repeat the above tests for all pages of your website.
If you cannot find the CANONICAL declaration in your HTML code, it means that your theme is not SEO Friendly and it does not support it.
Don’t worry though, you can install the free version of Yoast SEO plugin and it will do this automatically for all your website posts and pages (including the homepage and archive pages).
What if I want to change my preferred domain and add or remove the www for an already established website?
This is highly NOT recommended. If you already have an established website then there is no reason for changing your preferred domain.
In case you do want to do this, you will have to add 301 Redirects to redirect traffic and links from one version of the domain to the other.
What happens when you migrate from http to https?
When you migrate your website to https, you should make sure that you keep the same format in Site Settings i.e. if your previous preferred domain was http://www.example.com, then change it to https://www.example.com and NOT to https://example.com.
Once the migration is completed, you need to ADD and VERIFY both https://www and https:// with Google Search Console and set your preferred domain to match your previous settings.
To www or no www is a matter of preference. There is no SEO advantage from choosing one version or the other but once you choose the one you like, stick with it for the lifetime of your website.
When setting up a new website or performing a technical SEO Audit of an existing website, this is one of the first things to check.