Call Email

In this blog post I’m going to tell you how to implement a domain 301 redirect with htaccess file.

What is a 301 redirect and why do I need it.

That’s a good question, dear reader. Well, it’s all down to how the mighty Googlebot sees your website, and what people type in to find you. You know that your website usually starts with www. right? But you can also just type in the domain name (plus etc) and still get to your website, which is great and it makes sure that people can still get to you. However… good old Google may interpret this as you having TWO websites and slap you with a duplicate content penalty. Also, it dilutes the SEO on your site as you may be splitting search results between 2 sites.

So that’s a problem, yes?

Good news is, it’s easy to fix. All you need is:

  • Access to the .htaccess file on your website. You can find it on your hosting servers control panel when you go to file manager.
  • The ability to copy and paste the following text…

301 redirect htaccess code:

RewriteEngine On
RewriteCond {f5b33d95f7f254b1589baa1fdbba1c06f1c4679eb1514e4c27da6e662326cefe}{HTTP_HOST} !^www.
RewriteRule ^(.*)$ http://www.{f5b33d95f7f254b1589baa1fdbba1c06f1c4679eb1514e4c27da6e662326cefe}{HTTP_HOST}/$1 [R=301,L]

Simply copy and paste the code into your .htaccess file and any searches for your website are automatically redirected to the www. address. Your Google juice is doubled and you won’t get a duplicate content penalty.

See, I told you it was easy, but don’t underestimate how important it is.