How I redirect traffic from blogger pages to wordpress posts

Posted on January 11th, 2008 in blogging , hacks , technology - 5 comments

After moving the blog from the blogger to wordpress, my first challenge was to organize the posts for better discovery and search. I have done that by automatically generating tags and tagging posts using a bit of analysis and a bit of insanity.

The next challenge was to redirect the traffic from the old blogger posts to wordpress posts. Thanks to the beautiful wordpress search feature, my job is almost 90% done. The search is really powerful and fetches the correct posts 99% of the time. So instead of setting up either 301/401 redirects or adding complex javascript code or using some kind of mapping [old -> new] mechanism in PHP, all I had to do is to send the traffic from http://chandoo.org/blog/ [archive path] / [post title].html to http://chandoo.org/wp/?s=[post title] and wordpress would fetch and display the post for me.

So I went to my blogger template edit screen and added this piece of javascript code.


window.location = "http://www.chandoo.org/wp/?s= < $BlogItemTitle$ >";

The $BlogItemTitle$ is the old blogger tag for blog post title, which I am passing as an argument to my wordpress search.

How to redirect traffic, visitors, searches from blogger to wordpress posts

Since most of the people visiting the old posts on my blog are coming from search engines this method of redirecting is working perfectly for me. There are few problems though, this works only for post pages, if you have monthly / weekly archives like I do, some people may still visit the archive pages. I am thinking of adding permanent redirects or some PHP script to redirect the blogger archive requests to wordpress archives. But the traffic to those pages is small enough to neglect it for now. Once the search engines catch hold of new URLs I can permanently remove the old blog content from my website.

Feel free to comment incase you need some help in figuring out how to do this for your site.

Written by Chandoo
Tags: , , ,
Home: Chandoo.org Main Page
? Doubt: Ask an Excel Question

5 Responses to “How I redirect traffic from blogger pages to wordpress posts”

  1. [...] sneha article is brought to you using rss feeds.Here are some of the top articles on search engine optimization.Since most of the people visiting the old posts on my blog are coming from search engines this method of redirecting is working perfectly for me. There are few problems though, this works only for post pages, if you have monthly … [...]

  2. Kapil says:

    Can I do this with a blog address like kapsi.blogspot.com - and direct it to my current wordpress powered website at kapilb.com?

  3. Chandoo says:

    @kapil... you can do it with blogspot hosted blogs as well. I guess your blog is hosted on old blogger, if you have migrated to new blogger (which google literally forced everyone to do) then you may have to change the tag "$BlogItemTitle$" .

    In that case, near the blog header in "edit html" section of your blogger settings insert the below script. I havent tested, but i am guessing it should work with little or no corrections.

    SCRIPT

    < b:if cond=’data:blog.pageType == “item”‘ >
    < script >
    window.location = "http://www.kapilb.com/wp/?s= < data:post.title / >
    < / script >

    Oh yeah, you may have to adjust the spaces in that script, I had put spaces to ensure that comment gets published instead of being parsed.

  4. ankur? says:

    anyways people r not allowed to put adds on wordpress.com
    so how does it matter

  5. Chandoo says:

    @ankur... hmm, but you may want your visitors to find your site for other purposes also... For example, in my case I want to remove the old archives once most of my readers have updated their bookmarks or when I am getting no further visits to those files.

Leave a Reply