How to Forward from Blogger/Blogspot to your WordPress install

My wife and I have moved our blogs to a wordpress.org install; she because she lives to blog and me because I have tons of content littered throughout the internet and wanted to quickly and easily bring it into one place.  I have been building websites and generating audio/video/stories since about 1995 but I didn't have time to build a really uber-awesome super great web site; so when I found how out good wordpress was for my wife's blog, I installed it for myself, too.

Anyway, that's a long intro to a big problem: how do you get people over to your site when you move?

Blogger doesn't make it easy to forward people (I understand why, they are a business) to your new blog.  So a few google searches turned up this.

That was just what I needed, but Blogger/Spot had changed slightly and apparently the people who put that system together hadn't spent a lot of time with PHP; no matter, they were creative enough to make it go for awhile.  What I'm going to do is update their system a little so it works a) at all now that B/S has changed their templates b) better, with a little more secure code.

This takes a few steps but isn't impossible.  The chances of you messing up your install is low.  You'll have to have access to your web server via ssh or ftp.  You'll have to be able to log into Blogger to update the template.

Step 1 - setting up the WordPress end

Download this PHP script.  Right-click and download onto your computer.  It has to be called "from_blogger.php" (without the quotes).  Rename it if you have to.

Open it up in notepad or some editor like that.  Change the first line to your blog address.  For example:

$site = "http://hansanderson.com";

If your blog is in a sub-directory (say, if you have a big site about trinkets, you might have your blog at http://trinkets.com/blog), use that:

$site = "http://trinkets.com/blog";

That's it, upload it to your root blog directory.  That is, if your blog is at http://trinkets.com/blog, you upload it to the "blog" subdirectory.  It should be visible from the web address like this:

http://trinkets.com/blog/from_blogger.php.

Mine is at http://hansanderson.com/from_blogger.php

Step 2 - setting up the Blogger end

This is pretty easy but has more steps.  Ready?

Highlight and Copy this chunk of text:

<script language='javascript'>
document.location.href='http://hansanderson.com/from_blogger.php?p='+escape(document.location.href);
</script>

<meta content='5;url=http://hansanderson.com/' http-equiv='refresh'/>

Open up a new window in Notepad.  Paste it in there.  Erase the TWO places it says "hansanderson.com" and replace it with your blog name (whatever you put in the "$site" variable in the PHP script).  Notice that you will KEEP the "/from_blogger.php?p..." part in the first snippet but the second snippet, that starts with "<meta" will not have "from_blogger.php".  I'm not going to go into why, just accept it.

Now, highlight that chunk of text in Notepad and copy it again.

Go to your Blogger dashboard and follow these steps

  1. Choose your blog (if there are more than one)
  2. Go to layout, "edit html"
  3. blogger2wp-howto1

  4. search through that box full of html/css tags, look for "<head>" (without the quotes), it's pretty close to the top
  5. right BELOW <head>, paste the text
  6. blogger2wp-howto2

    blogger2wp-howto3

  7. Click "save template" then try to view your blog. You should go to your new front page.
  8. Go to Posting, Edit Posts, click "View" on any one of the blogs posts in the list; you should go directly to that post on your new server (after a couple of redirects)

Keep in mind that some posts may not work; it seems if you choose a title, then change it, blogger uses the old title as the "slug" -- the last part of the URL that says something like the-day-I-ate-ice-cream (as in, /2008/05/the-day-I-ate-ice-cream). If you changed the title, that slug stays the same (this is probably smart... not really a flaw for blogger, just for us who are trying to convert). WordPress creates the slug anew when you import.

If you like to change your titles a lot, you will have a lot of redirects to your blog front page.

--- February 26th, 2009 :: Misc ::