Envira Gallery Blog

Digital Photography Tips, Tutorials and Resources

Switch to Blogger from WordPress

How to Switch to WordPress from Blogger

by Waseem Abbas on Aug 3, 2016

Do you want to move your blog from blogger to WordPress? Blogger is a great tool to start blogging, but as you grow with your articles, you may need a more flexible platform like WordPress. In this article, we will share how to switch to WordPress from Blogger.

Setting up Your WordPress Blog

First thing you need to do is setup WordPress.

To setup your WordPress blog, you need to select a good hosting company. We recommend that you choose either WP Engine or Hostgator. These two are the best managed WordPress hosting companies.

After choosing your hosting company, you can setup the domain and install WordPress. To learn how, check out this step by step guide on how to install WordPress.

Upon installation, you are now ready to switch to WordPress from Blogger!

Switch to WordPress from Blogger

You should start by exporting the content from your Blogger blog. Simply go to Settings » Other in your Blogger dashboard and hit the Back up content button.

Backup Content

It will popup a window for you asking to back up content. Click on the Save to your computer button.

Save Content

An XML file will be saved in your computer. You can now import this file into WordPress.

To import Blogger content in WordPress, you need to go to Tools » Import from your WordPress backend and select the Blogger importer.

Import Blogger

It will show a popup. Simply click on the Install Now button.

Install Now

You need to click on the Activate Plugin & Run Importer link in the next step.

Activate Plugin

Now click on the Browse button and choose the XML file that you downloaded in the previous step.

Browse XML

Hit the Upload file & import button.

If the XML file is large in size, then you will see an error for the upload file size limit. However, the hosting companies we recommended above provide great support, and they can help you to increase the file size limit.

You should also check out this guide to learn how to increase file upload size in WordPress.

After uploading, WordPress will import all your Blogger content. It will ask you to either add the content as a new author or to choose an author from the dropdown menu.

Set Author

Once all of your content has been imported into WordPress, you should setup the links and redirects so you don’t loose your search rankings. Doing this will also make sure that the users who visit your old Blogger blog will see the new WordPress blog.

Setup the URL Structure

WordPress has a built-in URL structure called Permalinks. You can go to Settings » Permalinks from your WordPress backend and try to match the WordPress URL structure with your Blogger URL structure.

To do that, choose the Month and Name as your permalink structure.

Month and Date

Setup the Link Redirection

Next, you need to make sure that you setup proper redirection, so all the visitors to your old Blogge blog will be redirected to your new WordPress blog.

There will be two stages of redirection. In the first stage, you take your Blogger visitors to WordPress. In the second stage, you redirect the visitor to the correct content in WordPress.

Lets start with the Blogger. Simply go to Template from the left sidebar menu at your Blogger account.

Template

You need to scroll down on this page and click on the Revert to Classic Template.

Revert Template

Once you switch to classic template, it will show you a Edit Template HTML window. You need to replace the below given code in that window:


<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>

In this code, you need to replace http://example.com/ with your domain name. After making the changes, hit the Save Template button.

Next, you need to set the redirection in WordPress, so your visitors land on the correct page.

In your WordPress theme’s funtion.php file, you need to paste the below given code:


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();
}

This code adds a Blogger to WordPress 301 redirect, so anyone visiting your Blogger post will be redirected to the same post in WordPress.

It also helps you to maintain your search engine rankings.

Add Redirection to Feeds

You may have RSS subscribers on your Blogger blog, so you should also redirect your old Blogger feed to your new WordPress feed.

To redirect the RSS feed, simply go to Settings » Other in your Blogger dashboard.

In the Site Feed, you need to click on Add next to Post Feed Redirect URL and add your WordPress site feed URL.

Feed Redirect

Importing Images from Blogger to WordPress

WordPress has a built-in Media Library that stores images, however WordPress importer works great for importing your images from Blogger. If you find any errors in importing images, then you should check out this guide on how to import external images in WordPress.

After importing your images, you can create beautiful image galleries and photo albums in WordPress. You can learn more about how to create an image gallery with thumbnails in WordPress here.

We hope this article has helped you to learn how to switch to WordPress from Blogger. You may also want to check out our guide on how to import and export Envira gallery and albums.

If you like this article, then please follow us on Facebook and Twitter for more free WordPress tutorials.

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.