I decided to move one of my Blogger-based, blogspot.com-hosted blogs (this one, in fact!) over to my own server, using Wordpress. My requirements:
- Move the content easily
- Preserve all links
After a little help from Google, I was able to achieve both pretty easily. Here’s what I did.
For moving the content, if you are hosting your Blogger blog at blogspot.com, and your new Wordpress is at least 2.1 (it better be!), then you are in for a treat. All you have to do (in your Wordpress blog), is go to Manage, Import. Then select Blogger, and click Authorize. You will be redirected to a Google page, asking you if you want to grant access. Grant that, then you get sent back to your blog, and are presented with… the magic button!

Fig. 1. The Magic Button.
Just press that, and watch the progress bar fill as all your posts and comments are imported. Awesome. And then you can even set the author for the imported posts, in case your name differs between the blogs. (Say you used to go by “1337\/\/3b|\/|4ster”. It’s ok to admit it.)
Now you have all your content in your new Wordpress blog. If you don’t give a fig about Google indexes, PageRank, links on other sites, or your horde of loyal subscribers, feel free to stop here.
However, with a little more effort, you can redirect all the same URLs on your old blog to their new location! The following steps are taken from this handy guide. I will put the code here as well, since that page uses annoying characters that got messed up when I pasted the blocks into an editor.
You will need to login to your Blogger account and go into Settings for the blog you are moving. Then go to the Template tab, and Edit HTML. If you are not on the Classic template, you might not be able to follow these instructions exactly, as the tags are different. After your opening <head> tag, add this line:
1
| <meta http-equiv="refresh" content="0;url=http://www.YOURSITE.com/" /> |
Make sure to replace YOURSITE throughout these examples with your own URL. Next, under the
<Blogger> tag, add:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| <MainOrArchivePage>
<script language="javascript"><!--
var blog_root=http://www.YOURSITE.com/;
document.location.href=blog_root;
//--></script>
</MainOrArchivePage>
<ItemPage>
<script language="javascript"><!--
var process_page="http://www.YOURSITE.com/blogger_redirects.php";
var newpage=process_page;
var oldlink="<$BlogItemPermalinkUrl$>";
newpage+="?p="+oldlink;
newpage=newpage.toLowerCase();
document.location.href=newpage;
//--></script>
</ItemPage> |
Lastly, you will need to add the following file as
(or if you change the name, change the name in the code above) in the root of your new Wordpress’ blog. Be sure to set proper owner on that as well:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| <?php
require($_SERVER['DOCUMENT_ROOT'].'/wp-blog-header.php');
$search_link = $_GET['p'];
$vars = explode('/', $search_link);
$num = count($vars) - 1;
$filename = $vars[$num];
$slug = str_replace(".html", "", $filename);
$SQL = "SELECT posts.* FROM $wpdb->posts AS posts WHERE posts.post_name = '$slug' LIMIT 1";
$posts = $wpdb->get_results("$SQL");
if ($posts) {
foreach ($posts as $post) {
$found_link = get_permalink ($post->ID);
}
}
else
{
$found_link = "http://www.YOURSITE.com/";
}
?>
<html>
<head>
<title>Redirecting...</title>
<script language="javascript"><!-
document.location.href=" <?php echo ($found_link); ?>";
//-></script>
<meta http-equiv="refresh" content="2;url= <?php echo ($found_link); ?>">
</head>
<body>
<h1>This blog has a new home!</h1>
<h1>Redirecting...</h1>
<p>You can also proceed immediately to <a href=" <?php echo ($found_link); ?>"> <?php echo ($found_link); ?></a>.</p>
<p>The main blog URL is <a href="http://www.YOURSITE.com/" mce_href="http://www.YOURSITE.com/">www.YOURSITE.com</a>.</p>
</body>
</html> |
At this point, anyone hitting your old blog’s homepage, or any blog post, will be redirected to your new URL. If the script you added can find a matching page, it will send them there. If not, they at least go to your new homepage. Now to ensure that it DOES find a matching page, you can change your permalink structure (under Settings in Wordpress) to match your old Blogger blog. There are two other steps you will want to take on that note:
- Edit permalinks
- Handle .html Blogger URLs
For these two, you can follow this guide created by the maker of a Wordpress plugin that does this for you! Basically you just install the plugin, run it, and add some lines to your .htaccess file.
That’s it! A few minutes, and you will have a shiny new more flexible Wordpress blog, with all your old content, and handy redirects for Google and all your followers.
[Edit, 2008-10-28:] You might get a message from Blogger after taking these steps that your blog has been blocked as a spam blog! I believe it is just due to the redirection, which might indeed be used by ad sites. You just fill out a form they email you a link to, a human looks at it, and all is well.