How to set up a preferred domain

If you don't set up a preferred domain, search engines may treat www and non-www versions of your domain as two independent websites. You might ask, but why should i care? It may not look like a problem because visitors to both domains are still able to reach your website and browse your content, but having two versions of your domain & content can in fact have dramatic consequences on your search engine optimization campaign. Specifying your preferred domain will basically tell search engines what version you want to display in search engine result pages (SERP), and at the same time avoid being penalized because of duplicate content. Another important aspect of setting up a preferred domain, is that links may point to your website using both non-www and www URLs. From an SEO point of view, this means you will fail to funnel the "link juice" correctly from referring domains.
In order to make sure that link juice & traffic flows nicely to a single domain, there are two things you need to do:
  1. Set a preferred domain using Google Webmaster Tools [caption id="attachment_1009" align="alignnone" width="504"]Setting up a preffered domain in Google Webmaster Tools Note that you may need to verify ownership of both domains[/caption]   2. "301 redirect" traffic from the non-preferred domain using .htaccess [code lang="apache"]RewriteEngine On RewriteCond %{HTTP_HOST} !^(.*)$ [NC] RewriteRule ^(.*)$$1 [R=301,L][/code]   [code lang="apache"]RewriteEngine On RewriteCond %{HTTP_HOST} ^$ [NC] RewriteRule ^(.*)$$1 [R=301,L][/code]   That is it, there you have it, simple as that ...yet another SEO quick win. Good luck!