WWW and NON-WWW 301 Redirect

This article will show you how to redirect 301 from WWW to NON-WWW domain / NON-WWW to WWW. Many webmasters are confused when consider to choose preferred domain (www or non-www) for their websites and which version will have better SEO benefits. The answer is : you can pick www or non-www, both versions have same SEO benefits. But please remember that just choose one and redirect 301 other to your preferred version if you dont want to double your SEO efforts.

301 Redirect Rules:

You need to edit your .htaccess file locates at your root directory of your website. Then add redirect rules below:

Redirect from non-www to www

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

From www to non-www

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

After that , your visitors can access your websites with both versions (WWW or Non-WWW), just one of them will be redirected to your preferred version.

You can also set preferred domain with Google Webmaster Tools.
“The preferred domain is the one that you would liked used to index your site’s pages (sometimes this is referred to as the canonical domain). Links may point to your site using both the www and non-www versions of the URL (for instance, http://www.example.com and http://example.com). The preferred domain is the version that you want used for your site in the search results.”

Specify a preferred domain:

On the Webmaster Tools Home page, click the site you want.
Under Site configuration, click Settings.
In the Preferred domain section, select the option you want.

For more information, you can read at http://support.google.com/webmasters/bin/answer.py?hl=en&answer=44231

Written on 30 April 2012

Share your thoughts