If you have opted to transfer your Blogger blog to WordPress, then, firstly, congratulations. This is a big step in your blog or website’s path to opening it up to the world of WordPress, which has the potentially to really propel your website to future success. However, with this, it is little complicated how to go about transferring a website from Blogger to WordPress. To help you with this process, here is a step-by-step guide as to how I did it for one of my websites.
#1 Export Content from Blogger
The first step is to export the content (posts, tags, categories and comments) from Blogger to a ‘xml’ format. You can do this by going to Settings (in Blogger) / Other and then click ‘Back up Content’.
When I did this, I found that the Pages in the Blogger blog were not included in the .xml file, which meant I had to manually transfer them to Blogger. Maybe this was just an occurance when I did it. If it is not, most websites, at most, will have several pages so it was not be a lengthy process to do.
#2 Get a Hosted WordPress Website
Once you have exported your content from Blogger, you will need to get a WordPress website and buy hosting for it. This is relatively straight forward to do so shouldn’t be too much of a problem.
Once you have done this, you need to set-up your website into the same structure as Blogger was for posts – this consisted of /%year%/%monthnum%/%postname%/.
Category and tag pages will be different from Blogger. However, I would not worry about these, unless your category/tag pages were getting a lot of traffic and good SEO.
#3 Import .xml to WordPress
Once you have done this, to import your Blogger content to WordPress, this is done via navigating to Tools / Import and then Blogger (for which you will have to download a plugin first before using). Once your .xml has been imported, you will need to assign all of the articles to a user, such as yourself.
Once you have done this comes the ‘housekeeping’ manual bit.
The problem is that Blogger tends to like to leave certain words out of the slug whilst WordPress does not. So, just to be safe, it is worth going through every article to make sure the post slug is the same in Blogger as it is in WordPress. If not, change the slug in WordPress.
As well as this, now would also be a good time to copy the pages over from Blogger.
#4 Set up Redirections
The first redirection you need to do is for your Blogger blog to direct to the WordPress website. This can be done by reverting to a classic template and using the below code as the template code:
<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>
Where ‘example’ would be replaced by your website’s domain name.
Once you have done this, by adding the below code to your functions.php file in WordPress, all posts from Blogger will redirect to the correct version of the post in WordPress:
function blogger_query_vars_filter( $vars ) { $vars[] = “blogger”; return $vars; } add_filter(‘query_vars’, ‘blogger_query_vars_filter’); function blogger_template_redirect() { global $wp_query; $blogger = $wp_query->query_vars[‘blogger’]; if ( isset ( $blogger ) ) { wp_redirect( get_wordpress_url ( $blogger ) , 301 ); exit; } } add_action( ‘template_redirect’, ‘blogger_template_redirect’ ); function get_wordpress_url($blogger) { if ( preg_match(‘@^(?:https?://)?([^/]+)(.*)@i’, $blogger, $url_parts) ) { $query = new WP_Query ( array ( “meta_key” => “blogger_permalink”, “meta_value” => $url_parts[2] ) ); if ($query->have_posts()) { $query->the_post(); $url = get_permalink(); } wp_reset_postdata(); } return $url ? $url : home_url(); }
The last step is to then change the domain name nameservers to your new host and bingo you are done!