I get asked this question a lot.  Usually, it stems from a couple of sources…

1) Someone uses the wonderful tool over at WebsiteGrader to check their website.  One of the suggestions, is to use a 301 redirect to make sure either the non-www goes to the www version, or that the www version of your URL goes to the non-www.

2) Pragmites includes a short list of suggested optimizations when they do some link building for you.  One of their suggestions is the 301 redirect.

If you don’t know what a 301 redirect is, I suggest you start reading this article: What is a 301 Redirect?

Personally, I really stink at doing .htaccess modifications… so trying to figure out how to do this through .htaccess was not an easy task for me.  Until I found that someone had already done this, and had already written it up too!

SEO Book to the Rescue!

SEO has an excellent article on how to create a 301 redirect for your website. 

They have examples of how to 301 redirect non-www to www, how to redirect from www to non-www, and even one about HTTPS redirects…

Plus, as an added bonus, a way to redirect a large number of URLs from an old website, to a new one (PHP coding required for this last method).