Ubuntu / Linux news and application reviews.

Firstly, please note that this tutorial will be a step by step howto for Blogger blogs but will work on any other html blogs too.

This post will be dealing with 3 major aspects of redirecting a blog to another one:

a) How to redirect visitors to the old blog automatically to the new pages.
b) How to transfer the PageRank of your old blog to the new one.
c) How to prevent being penalized by Google for duplicate content.

How to redirect visitors to the old blog automatically to the new pages.

The first thing to do is export your blog, then import it to the new blog. Then, on the old Blogger blog, to to your Layout > Edit HTML and between the <head> </head> tags, put this:
<meta content='4;url=http://yournewblog.com/' http-equiv='refresh'/> 

Where "4" is the number of seconds before the redirect and http://yournewblog.com/ is the address of the blog you want to redirect to.

Now we must redirect individual posts which is a bit tricky since we cannot add a 301 permanent redirect on the Blogger server. So, to achieve individual posts redirect (meaning: each individual post will redirect to it's corresponding post on the new blog), insert the following code right after <b:section class='main' id='main' showaddelement='no'> in your template:
<b:widget id='Redirector' locked='true' title='Blog Posts' type='Blog'>
<b:includable id='main'>
<b:if cond='data:blog.pageType == "item"'>
<b:loop values='data:posts' var='post'>
<script type='text/javascript'>
var new_page='yournewblog.com/';
var permalink = '<data:post.url/>';
var timestamp = '<data:post.timestamp/>';
timestamp = timestamp.split('/');
timestamp = timestamp[2]+'/'+timestamp[0]+'/'+timestamp[1];
new_page = permalink.replace(/youroldblog\.blogspot\.com\/2007\/[0-9]{2}/,new_page+timestamp);
new_page = new_page.replace(/\.html$/,'');
document.location.href = new_page;
</script>
</b:loop>
</b:if>
</b:includable>
</b:widget>
Obviously, replace yournewblog.com with the address to the blog you want to redirect to.

Important: if importing to Wordpress, all your posts should have been imported to Wordpress.com using their Manage/Import function. The creation dates of all posts must match, because they are part of the permalinks.

Now that the redirect has been set, we must make sure Google doesn't find our old blog as duplicate content to the new on:

Remove duplicate content

Insert the following between the <head> and </head> tags of your old blog:
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW"/>
After seeing this, search engines should remove your old blog from their cache and the old content will stop existing for them. Therefore they are not going to penalize your new blog for duplicate content.

Display a message on your old blog, before the redirect occurs


This is an optional step. You can use it to tell your readers that you have moved your blog, why or... whatever you want.

To do this, go to your old blog's Layout > Edit HTML and insert the following code right after the <body> tag:
<div style='position: absolute; top: 30px; left: 30px; border: solid 2px #333; color: #000; background-color: yellow; padding: 5px; width: 400px; z-index: 5; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: large;'>
<p><strong>My blog has moved!</strong></p>
<p>You will be automatically redirected to the new address. If that does not occur, visit<br/> <a href='http://yournewblog.com/'> <strong>http://yournewblog.com</strong></a> <br/> and update your bookmarks.</p>
</div> 

[credits: laffers]