To avoid dublicate content penalties you need to fix the www vs non-www canonical issue for Your Domain. Google doesn't have different weights on any so it`s up to your personal preferences which URL looks better to you. Most important: You have to decide for seo reasons. This also concentrate your backlinks to one version. With this fix domain.com will automatically use a permanent redirect to www.domain.com or way round.
.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
- Add the preferred rewrite rule to .htaccess which is located in your website's root folder.
- Add and verify both versions in google webmasters tools.
- Select your prefered version: Google Webmasters Tools: upper right -> Site settings -> select your preferred domain (update: I haven't found that setting in the new version of google webmaster tools so easiest workaround is to switch to the old version.)
- 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.
- Confirm your setup by testing both versions with this redirection checker. It 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.