If you are going to do something, then it is worth doing right. Right?

To really optimize you search engine rankings, you need to do a few basic things with your blog. Setting up a 301 redirect is one of them.

301 what?

A redirect, as the name suggests, takes you from one place to another. For example, you can set up a redirect at http://abc.com/ so that whenever anyone comes to abc.com they are AUTOMATICALLY taken to http://xyz.com.

In our case, setting up a 301 redirect is important to help your blog with its SEO rankings. You see, as far as search engines like Google are concerned, http://blogstarta.com and http://www.blogstarta.com are two completely different sites. But in normal practice, they are the same. So what happens? Someone links back to your blog with http://www.blogstarta.com/ and some without the ‘www’. This divides your linkback count, which really should not be the case. There ought to be consistency primarily because consistency helps with the SEO of your blog/website. You need to enforce consistency on your end (you really can’t enforce this on the linker’s end; you should be thanking the linker, not enforcing stuff on him!). Also, it does not matter what you decide (to go with WWW or without), but what matter is that you do decide, and stick with it. (I am sure there is a deep philosophical tangent to this, but that’s for later 🙂 )

I recently set up a redirect to one of my blogs, and I just edited the header.php file, and on the top, I added the following lines:

if (substr($_SERVER[‘HTTP_HOST’],0,3) == ‘www’) {
header(‘HTTP/1.1 301 Moved Permanently’);
header(‘Location: http://’.$_SERVER[‘HTTP_HOST’]

<?phpif (substr($_SERVER[‘HTTP_HOST’],0,3) == ‘www’) {header(‘HTTP/1.1 301 Moved Permanently’);header(‘Location: http://’.$_SERVER[‘HTTP_HOST’].$_SERVER[‘REQUEST_URI’]);}?>

But this is not the only way to do this. A great resource on different ways of doing basically the same thing i.e. a 301 redirect can be found here.