psst.. this blog is on hiatus.

Moving from Blogger to WordPress: Best Practices

I recently moved a friend’s medium-size blog from Blogger to hosted WordPress (on DreamHost, not WordPress.com), and I thought I’d share a few tips for making the transition smooth.

Background

If you’re interested in why moving your blog from Blogger to WordPress is a good idea, look no further than Anita Campbell’s write-up. Once the birth pains of the transition are over, there are no real drawbacks besides lost PageRank from your Blogger blog—if you published on BlogSpot and can’t transfer that Googlejuice to your new host via a real 301 redirect.

Note: If you’re self-hosting your Blogger blog, check out Maintain permalinks moving from Blogger to WordPress by Justin Watt. If you need to convert from Blogger Beta to WordPress, check out this tutorial. My tutorial below does not work for Blogger Beta.

Requirements

This is what you need to play:

  • A Blogger-driven weblog
  • A fully installed version of WordPress 2.0+ (it has the nice import utility)
  • A basic text editor – Notepad will do
  • Some technical know-how (or an adventurous spirit), because I’m not going to hold your hand

What this will and will not accomplish

  • Will redirect visitors no matter what their browser situation
  • Will redirect them to the best, most relevant page on your new WordPress blog
  • Will not preserve PageRank from your BlogSpot blog to your new blog. This would require a 301 Permanent Redirect and access to the server, not provided by Blogger.
    • If you publish using Blogger to a remote location using FTP/SFTP, you may be able to preserve PageRank. However, I’m not going to cover that here. You will need to research 301 redirection from your Blogger server to your WordPress server using 301 redirection.

The menu

Here’s what we’ll be doing today, kids:

  1. Saving the Blogger template
  2. Backing up data from Blogger
  3. Import data from Blogger into WordPress
  4. Prepare the WordPress host for redirects from Blogger
  5. Modify the Blogger template to include redirects
  6. Test!

Some of this is based on a tips page from Quick Online tips.

Step 1: Save the Blogger template

Click the Template tab, highlight the text, paste it into a text editor and save it.

Step 2: Back up data from Blogger

Follow Blogger’s detailed directions on backing up your data. (In essence, you change your template to post a text file of all your entries to the homepage of your site.) It’s a little wonky; I couldn’t get the backup to work with comments, so I just backed up entries.

Step 3: Import data from Blogger into WordPress

This is the coolest step. :) WordPress 2.0 has a straight-up slick import utility for Blogger. Go into the WordPress admin area, select the Import tab, select Blogger as the type of blog you’ll be importing, and follow the directions. Looove it.

Step 4: Prepare the WordPress host for redirects from Blogger

Credit a file in a text editor called from_blogger.php and put the following into it. Wherever there is the text http://www.yoursite.com/blog/, replace it with the root location of your WordPress blog!

This file will take the redirect from Step 5, parse the URL that’s being passed from Blogger, and redirect the user to the corresponding imported entry on WordPress. If it can’t find the corresponding entry, it directs to the root of the blog.

Put this file somewhere on your WordPress host. If you don’t want to modify anything else in this tutorial, put it at http://www.yoursite.com/from_blogger.php.

I owe this section partially to Owen Barder. (I say “partially” because his code had formatting issues and a big typo that I spent a long time trying to debug, and therefore I’m not giving him all the credit. :)

Step 5: Modify the Blogger template to include redirects

Remember the text file with the Blogger template from Step 1? Open it and Save As with a new filename. We’ve got a couple of things to add.

  1. Immediately after the opening <Blogger> tag, add the following:

    This will redirect to the root of your new WordPress blog if the users come to a main or archive page on your Blogger site. If they come to the page of an individual blog entry, it will redirect them to the from_blogger.php script, where we’ll try to pass them along to the appropriate location in the new WordPress blog.

  2. Add the following in the <head>:<meta http-equiv="refresh" content="5;url=http://www.yoursite.com/blog/" />

    This will redirect folks who have javascript disabled.

  3. Add the following helpful text for the non-javascript users who won’t be immediately redirected. This will display as a yellow box that sits above all other content in the top-left corner.
    <div style="position: absolute; top: 30px; left: 30px; border: solid 2px #333; color: #000; background-color: yellow; padding: 5px; width: 350px; z-index: 5;">
    <p><strong>My blog has moved!  Redirecting...</strong></p>
    <p>You should be automatically redirected.  If not, visit <a href="http://www.yoursite.com/blog/">http://www.yoursite.com/blog/</a> and update your bookmarks.</p>
    </div>
  4. Fully republish your Blogger blog.

Test!

It’s always a good idea to test! However, it can be tricky in this situation you’ll be immediately redirected from your old blog to your new blog as soon as your visit, getting the same treatment as your visitors.

To test, first turn off javascript.

  • In Firefox, go to Tools > Options > Content > uncheck Enable Javascript.
  • In Internet Explorer, go to Tools > Internet Options > Security > Internet Zone > Custom Level… > disable “Active Scripting” (under Scripting).

Now try the following tests:

  1. Go to the homepage of your old blog. You should be redirected in 5 seconds to the homepage of your new blog.
  2. Go to the homepage of your old blog. Go to an individual entry page. Turn javascript on. Reload the page. You should be transferred to the corresponding individual entry page on your new blog.

Conclusion

Well, there we have it! We backed up our template and our data first, but then we created the world’s friendliest redirects from Blogger to WordPress so users with bookmarks to old entries get shot right over to the appropriate entry on our new website. Hooray for beer!

I imagine that some of you won’t get this right on the first try, but please try to be self-sufficient before posting questions here. I’ll be very hesitant to even respond. There are lots of other resources on the Web about how to do the Blogger to WordPress migration; I just thought I’d post my experience.