www and non-www domain

How to set your preferred domain

Last Update:

To avoid dublicate content penalties you need to fix the www vs non-www canonical issue for Your Domain. This also concentrate your backlinks to one version. With this fix domain.com will automatically use a permanent redirect to www.domain.com.

.htaccess 301 permanent redirection

Choose one of these redirections – there`s no SEO difference.  Copy and paste it to your .htaccess file.

#Force www:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC]

Or:

#Force non-www:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

Checklist for domain redirection setup

  1. Add the preferred rewrite rule to .htaccess which is located in your website’s root folder.
  2. Add and verify both versions in google webmasters tools.
  3. Select your prefered version: Google Webmasters Tools: upper right -> Site settings -> select your preferred domain
  4. Check your WordPress setup: Settings -> general and make sure that you are using your preferred domain there too. We fixed it with the redirection but better be save than sorry in case a plugin uses these values.
  5. Confirm your setup by testing both versions with this redirection checker. One should show: “301 moved permanently” – the other “direct link”

 

This is an important SEO ranking factor and helps searchengines to index your site properly. Without this declaration your site can be seen as a mirror with identical content. Searchengines may rank a page with www. in front higher, and another page is ranked without the www. That leads to a diversification of your domain authority and dilutes your link strength. People will place your links all over the web. They don’t care if it is http:// or http://www. thus you as a webmaster need to take care of it.

It’s up to your personal preference which version you choose but DO choose one. With SEO in mind there`s no difference which version you choose.