We often read about the usage of 301 redirects as the most efficient and Search Engine Friendly method for webpage redirection. However, rarely there is a mention of 301 redirects used to eliminate the potential for duplicate content.

Google (or any other major search engine) considers pages found within www versus non-www (www.yourdomain.com versus yourdomain.com) as different. Most of us would think they are the same, thus assuming www.domain.com, and domain.com are the same. Actually they are not. From a search engine perspective, they are treated differently in that some content can be considered as duplicate content. Furthermore, having www.domain.com, and domain.com can cause the negative effects of link fragmentation, meaning some links are pointing to domain.com and some to www.domain.com.

If you running apache, add the following code to your htaccess file in the root of your website:

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


Source : Simple Pixel