Force Google to display domain name with www

Setting a preferred domain to www or none in Google Webmaster tool can be confusing. Here is an easy to follow step by step instruction.

First Log in to your account Google Webmaster Tools (if you don't have an account, register your website and validate your ownership first).

1 - In the main page, on the top right click on settings > Site settings:

2 - Navigate to Preferred domain:

3 - Click on the www :

You should get an error:

Part of the process of setting a preferred domain is to verify that you own http://example.com. Please verify http://example.com

What is not explicit here is how to verify the non www version of our site...

The next step is to add the 'non www' domain in Google Webmaster Tools as well (same process you did for the www version).So, go back to the home page of Google Webmaster Tools and click on ADD A SITE on the top right:

Enter your domain name without the www, like example.com:

Then validate your ownership:

Now that the 2 versions of the domain are verified, you can go back to step 1 to 3 to change your preferred domain to www.