Migrating From Blogger to WordPress

 

wordpress_logo_8Last week, I decided to move this blog from Blogger to WordPress. Here’s the thing, I have been using Blogger on my main blog (taleofale.com) since 2008 and have thought about migrating to full self-hosted WordPress (not wordpress.com) for years. The reason being that Google seem to have stopped developing Blogger and wordpress has become so much more powerful as a CMS and blogging platform.

Since this blog is only a matter of weeks old, I felt it was the perfect test as there were only 4 posts to migrate. The first thing to do was backup/export my Blogger blog.

Beginning the migration

1

In Blogger, I went to settings, Other and Back Up Content. Select Save to your computer and download the file. This produced a single .xml file containing the whole blog but at 488kb it only contained the text, layout & comments.

Hosting WordPress

The next step was to import in to WordPress. Let’s just pause here for a moment. I said I was using self hosted WordPress. I signed up to Letshost because I have used them before for previous websites. I also use them in work where we use their re-seller package to provide a few of our IT customers with hosting. There are cheaper hosts out there that offer more features but Letshost is based in Ireland and uses Irish servers so I trust their speed mover servers hosted in the US or elsewhere. I used their basic shared hosting service which cost €94.80 ex vat for 2 years. It’s cheaper to get it for 2 years and that’s really not a lot of money.

I also knew from previous experience that there’s a promo code of transferhost which gives 20% off. This almost covered the VAT which is 23% in Ireland so in total, I paid €93.28 for the two years. They have no way of checking if you are actually transferring a host so if you are setting up for the first time, you can still use it while it’s valid. There are plenty of other hosts out there. Blacknight is another one I have used via some of my IT customers but I prefer the Letshost CPANEL interface.

Once you have your hosting account activated, it’s only a matter of setting the NAMESERVER of your domain name to Letshost or whoever you are using as a host. If you don’t have a domain name yet, you can get one from any domain registrar and set the nameservers to your host. Or you can use your host themselves. I use register365 for domain names myself though not for hosting as I don’t like their hosting. It’s also notoriously slow for wordpress in my experience.

Best advice I can give is do your research and pick a host that suits your budget but be sure to check reviews first, especially for how it deals with WordPress websites as WordPress wouldn’t be a fast CMS to load.

2

Here’s how to change your nameservers in register365 by the way. Under your domain name, go to DNS & Transfer Options, Change Nameservers and then add in the two or three nameservers for your host. Click update and sit back and relax because it can take up to 12 hours. In reality, it can be done in less than an hour but no need to stop there, you can still start setting up WordPress which is what I did next. You can technically update your windows HOSTS file to get in quicker but I didn’t bother with that as mine propagated within 10 minutes or so.

Installing WordPress

Since I used Letshost, I’ll include instructions for that. Your own host might be different but it shouldn’t be too hard to figure out. I logged on to letshostbilling.com and went to My Products & Services. Then click view details beside your hosting plan.

3

On the next screen, click Login to cPanel.4

5

Scroll down to Softaculous and run it. You might even see a list of popular apps there so if you see wordpress, just click directly on it. Otherwise, click Softaculous Apps Installer and select WordPress. Just fill in your details. There’s one thing to be very careful of.

6

The Directory section. Don’t fill that in, delete anything in there or else your blog will end up in a sub directory of your website. If I left that as the default shows in the screenshot, my blog would be located at http://reubengray.com/wp so bringing up reubengray.com would yield a page cannot be found error so be careful of that and delete anything in that box.

I also suggest you don’t use the default username of Admin to help prevent someone cracking your password and messing up your site. The site name and description aren’t too important as you can change that later, in fact when you import your Blogger data, that will change anyway. Once you are happy with the settings, just click install. It only takes a few minutes. If your domain has propagated to your new host, you will be able to login with the provided details on the next screen. If not, just wait a few hours and try again. You can download from wordpress.org and install manually if you prefer. There’s no reason I can think of to do that unless your host doesn’t have a one click install system.

Importing from Blogger

7

Once in your admin dashboard, go to Tools, Import and select Blogger – Run Importer. Select your file and click the Upload File & Import button. That’s it, your posts and comments should have come across. Just the text though, not the images. I had to download all of the images and upload them in to the posts again. A simple but tedious task. There’s a Blogger image import plugin that I tried but it didn’t work so I had to do it manually. I also found that Blogger pages didn’t transfer so I had to create my About Me page again. A simple copy/paste from the old blog did the trick.

Forwarding traffic to new WordPress site

Once I was happy that what appeared on my WordPress page was correct, it was time to ensure all traffic heads to the new site. Head back to the Blogger dashboard

8

Under Settings, Basic – Blog Address. If you have a domain there, remove it so it reverts back to your blogspot.com address.

Then head Template and click Revert to Classic Templates at the bottom and then in the HTML box, delete everything and replace with the following code. Make sure to replace example.com with your own domain name.

<html>
<head>
<title><$BlogPageTitle$></title>
<script>
<MainOrArchivePage>
window.location.href="http://example.com/"
</MainOrArchivePage>
<Blogger>
<ItemPage>
window.location.href="http://example.com/?blogger=<$BlogItemPermalinkURL$>"
</ItemPage>
</Blogger>
</script>
<MainPage>
<link rel="canonical" href="http://example.com/" />
</MainPage>
<Blogger>
<ItemPage>
<link rel="canonical" href="http://example.com/?blogger=<$BlogItemPermalinkURL$>" />
</ItemPage>
</Blogger>
</head>
<body>
<MainOrArchivePage>
<h1><a href="http://example.com/"><$BlogTitle$></a></h1>
</MainOrArchivePage>
<Blogger>
<ItemPage>
<h1><a href="http://example.com/?blogger=<$BlogItemPermalinkURL$>"><$BlogItemTitle$></a></h1>
<$BlogItemBody$>
</ItemPage>
</Blogger>
</body>
</html>

Great, now you always end up on your wordpress site, even if someone navigates to your name.blogspot.com address but what about existing google results and links? You will get a page not found error if you click a link from Google. If it’s a pretty new blog it probably doesn’t matter as Google will eventually figure it out but if it’s a popular blog that has been around for a while and has links going to your articles, you will want to fix them. I didn’t need to do this since it was only a few weeks old but I chose to do it anyway.

First, we set our blog structure to be similar to Blogger.

In WordPress, go to Settings – Permalinks and select Custom Structure. Enter: /%year%/%monthnum%/%postname%.html9

We then need to change our existing permalinks for the old posts. You should probably backup wordpress before the following. I didn’t bother personally but I recommend you do.

The code below needs to be copied to notepad and saved as something like fixlinks.php

<?php
/**
* Rewrite WordPress URLs to match Blogger permalinks exactly.
*
* This script is intended for one time use only after importing Blogger
* content into WordPress and should be removed from the server immediately
* after the script has run one time. It shouldn't be needed again after the
* initial rewrite.
*
* @version 0.1.0
* @author  WP Site Care
* @link    http://www.wpsitecare.com/import-blogger-to-wordpress/
*/
require_once 'wp-load.php';
/**
* Get all posts with blogger permalinks.
*
* @since  0.1.0
* @access public
* @global $wpdb
* @return array|bool $posts an array of WP_Post objects withe blogger permalinks
*/
function sitecare_get_blogger_posts() {
global $wpdb;
$posts = (array) $wpdb->get_results(
"SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = 'blogger_permalink'"
);
return empty( $posts ) ? false : $posts;
}
/**
* Update posts to match their previous blogger permalink structure.
*
* @since  0.1.0
* @access public
* @global $wpdb
* @return bool true if posts have been updated
*/
function sitecare_fix_blogger_permalinks() {
global $wpdb;
$wpdb->show_errors = true;
$updated = false;
$delete = '<h1>Please delete this file immediately.</h1>';
if ( ! $posts = sitecare_get_blogger_posts() ) {
echo '<h2>There are no posts to update.</h2>';
echo $delete;
return $updated;
}
foreach ( $posts as $post ) {
if ( ! is_object( $post ) ) {
continue;
}
$slug = isset( $post->meta_value ) ? explode( '/', $post->meta_value ) : false;
if ( ! $slug || ! isset( $slug[3], $post->post_id ) ) {
continue;
}
$slug = explode( '.', $slug[3] );
if ( ! isset( $slug[0] ) ) {
continue;
}
$wpdb->query( $wpdb->prepare(
"UPDATE $wpdb->posts SET post_name = %s WHERE ID = %s", $slug[0], $post->post_id
) );
if ( $wpdb->last_error ) {
echo $wpdb->last_error;
} else {
$updated = true;
$title = get_the_title( $post->post_id );
echo "<p>The permalink for <i>{$title}</i> has been updated to <code>{$slug[0]}</code></p>";
}
}
if ( $updated ) {
echo '<h2>Your permalinks have been fixed.</h2>';
echo $delete;
}
return $updated;
}
sitecare_fix_blogger_permalinks();

Then you need to upload that file to the root of your website. Then go to your website and run that file, for example reubengray.com/fixlinks.php (this has now been removed so don’t bother trying it).

That’s it. Once that comes back OK, you are good to go. Now, make sure to delete that fixlinks.php file as it has done its job and might pose a security issue if left there. Head in to google, search for one of your articles and it should work now.

Thanks for reading, I hope you found this helpful. I got help from two articles. The first one was here on wpbeginner.com and everything was fine until it came to the code he wanted inserted in the functions.php file. It didn’t work for me. So I then used this guide on wpsitecare.com and that’s where I found the fixlinks.php solution which worked perfectly. If you need any help or something that worked for me doesn’t work for you, one of those two guides might hold the solution.

Should I migrate?

If you are trying to decide if it’s worth the hassle to migrate, here are my thoughts. After the whole procedure on a relatively new blog (4 posts at the time), I decided not to move taleofale.com away from Blogger and here’s why.

At over 700 posts, that’s a lot of messing about, especially with images. There may be an easy way to get your images to transfer but it wasn’t in either of the guides that I was using.

The other thing you need to ask yourself is how you treat images. For me, when I write about beer they are central to the blog post. The way I work now is so streamlined, the thought of doing it any other way does not appeal. I use a Samsung Galaxy Note 4 to take my pictures. That phone has an amazing camera. Those images automatically upload to Google Photos.

10

When I need to add a photo in blogger, all I have to do is click add photo, select From your phone and select an image. There’s no uploading, no forwarding from my phone or plugging in cables to transfer. It is seamless and automatic and I don’t think I can set it up the same way in WordPress unless there’s a decent plugin that will do it. Perhaps there is.

The main reason to change to WordPress is to make your blog responsive but there are plenty of premium responsive themes available for Blogger. I use one called MagOne and it’s grand. Sure, Blogger will never be as powerful as WordPress but since it’s purely a blog and not a website, that doesn’t matter to me.

At the end of the day, just make up your own mind if it’s worth it or not.

 

By | 2016-09-12T16:03:47+00:00 September 12th, 2016|Uncategorized|

About the Author:

Leave A Comment