Transfer Blogger FTP to WordPress MySQL Site

Yesterday I managed to successfully transfer a Google Blogger generated blog over to a WordPress platform. The blog (actually 3 blogs) are hosted on my own domain (like this) and not on Blogspot / WordPress.com. But you can transfer from Blogger blogspot to WordPress.com if you desire too.

With WordPress it was actually very easy to do a transfer of all blog posts, comments and labels over to WordPress, as there is a built in import script that allows imports from several blog platforms as well as RSS feeds, Technorati tags and other social bookmarking sites.

The only problem that I had was that I wanted to keep my Blogger generated URLs in tact, so that all links and search engine listings would continue to work OK. This was actually very easily done, with a small piece of code to modify the import file.

So, how is it done?

Firstly, I downloaded my entire Blogger blog using FTP to my pc, so that if anything went wrong I had a back up at hand.

I then downloaded the latest version of WordPress (2.5.1) and uploaded it into my blog directory. I set up a new database in phpmyadmin, and then installed WordPress.

Once installed, I then went to my Blogger Dashboard, and in settings > publishing set my Blogger blog to be published on Blogspot.

Next I modified the code in the wordpress/wp-admin/import/blogger.php file with this:

preg_match(“/([^/]+).html$/”, $entry->old_permalink ,$matches);
$wpdb->query(“UPDATE $wpdb->posts SET post_name = ‘” . $matches[1] . “‘ WHERE ID = ‘$post_id’”);

so that the whole bit of code on the page looks like this:

$post_id = wp_insert_post($post);

preg_match(“/([^/]+).html$/”, $entry->old_permalink ,$matches);
$wpdb->query(“UPDATE $wpdb->posts SET post_name = ‘” . $matches[1] . “‘ WHERE ID = ‘$post_id’”);

if ( is_wp_error( $post_id ) )
return $post_id;

placing the above code immediately after the call to wp_insert_post. This file was then uploaded. (The code was obtained from my.opera.com. I did not create it myself! The code was written for an earlier WordPress release, but it seems to work well still in version 2.5.1.

Next, in the WordPress control panel, I selected import, allowed WordPress to access my Google Blogger account, and then on the list of blogs, the Blogspot hosted blog was available for importing. Click import, then that is it. Once all were imported, I did some spot checks, and the blogs mostly had the same URL as previously. Where they were different I simply changed the page URL in WordPress for each article (no rewrites or redirects were required).

I also imported two other blogs, so amalgamated three blogs into one. All the blogs are hosted on my health and fitness website, one being about sports, another on mental health, and the main one general health and fitness news. I decided to amalgamate these three blogs into one to mostly make them more manageable, and also because the mental health and sports blogs were rarely updated and were not ranking well in the SE’s.

Once all were imported, I changed the Blogger publishing option back to FTP, to avoid my blogs being shown under a blogspot domain and risking possible duplicate content penalties. It is easy to forget to do this. There is also no need to delete your Blogger blogs from Blogger, as there is no harm in leaving them there. Consider it a back up in case of server meltdown, MySQL errors, hackng etc. etc. In fact, the first step of downloading the entire Blogger blog is not really required, I just like to be safe.

Once the blog was running, I removed the Blogger date dirtectories (i.e. 2007, 2008) but left the archives and labels, as these are still listing in some search engines, and may as well stay as they are. I attempted an archive and label rewrite, but it failed. It is not as important as the actual blog URL, so I’ll leave it.

I probably spent most of my day yesterday actually choosing and modifying a template for the blog. I am now looking at widgets and plugins to install to improve my blogs performance. Oh, I also extended the ping list, so that hopefully once I start posting new articles, the blog will be more visible than it was with Blogger. I already have had one comment to moderate, which went very well.

Oh, regarding comments, I got a WordPress API key and set up the Askimet spam management plugin, which appears to be working nicely.

All in all a painless process to transfer a Blogger blog over to a WordPress platform.