Sep 01, 2010

Redirect specific posts from blogger to wordpress or other sites

Suppose you have started blogging with blogger blog and after some time, you have created a new blog in wordpress or other services. Now you want to move some special posts(NOT ALL) from old blog to new blog and redirect user for these posts. How can you do? Here is a simple way to do this.

First you need to copy the post and publish it in your new blog.

Login to blogger blog, Go to Design tab > Edit HTML and Add following script after <head>:


<script type='text/javascript'>
var urls = [
{oldurl: &#39;http://myblog.blogspot.com/mypost1.html&#39;,
newurl: &#39;http://mynewblog.com/mypost1/&#39;},
{oldurl:&#39;http://myblog.blogspot.com/mypost2.html&#39;,
 newurl:&#39;http://mynewblog.com/mypost2/&#39;},
{oldurl:&#39;http://myblog.blogspot.com/mypost3.html&#39;,
 newurl:&#39;http://mynewblog.com/mypost3/&#39;}
];

for(var i=0;i &lt; urls.length; i++)
{
if (window.location == urls[i].oldurl)
{
window.location.href = urls[i].newurl;
}
}
</script>

In above code, I have redirected 3 links like

http://myblog.blogspot.com/mypost1.html

to

http://mynewblog.com/mypost1/

You have to replace links with yours. You have to assign old post url in oldurl variable and new post url in newurl variable. You can add more links for redirecting. Make sure the last link does not have comma after } brace.

If you have any issue, add in comment box.

Enjoy this.