change-permalink-structure-after-migrating-from-blogger-to-wordpress

Change Permalink Structure after Migrating from Blogger to WordPress (And Retain all Traffic)

I have been planning to write this guide since I migrated my oldest blog from Blogger to WordPress earlier this year. That blog was on Blogger from the birth (2012). I attempted moving it from Blogger to WordPress for a few times in the span of approx 5 years but rolled back every time because of some reason or the other. The main reason for rolling back was the loss of SERP ranking and hence traffic. I was not confident enough that I will regain all the SERP ranking and traffic after moving from Blogger to WordPress untilĀ I figured out some tweaks. And yes, now the blog is ranking again as earlier, plus I could optimize some of the posts for Search Engine after migrating to WordPress and getting better results. I try not to get into any argument as what is better, Blogger or WordPress. But I agree that WordPress opens up more functionality for you comparing to Blogger, all because of its extensibility.

When I talk about WordPress in this article, I refer to WordPress.org and not WordPress.com.

I’ll keep this article short and crisp, focusing on the main intention. There are many typical guides you may come across when you do a simple Google search about Migrating from Blogger to WordPress or something like that. Trust me, I’m not going to write as such here šŸ™‚

The most important thing we have to do after migrating from Blogger to WordPress is to take care of the permalinks. And I’ll talk about them in this guide. If you keep the default permalink structure of WordPress, the majority of the links will be properly redirected. However, there are the following cases where we need to manually do some tweaks to get rid of any further 404 errors šŸ™‚

Read also:Ā Create your own Facebook Viral Comment Script in next 2 minutes

1. Posts are ranking in the SERP with mobile links

As you might be aware, blogger links will have a query string m?=1 when opening in a mobile browser. And if a majority of the traffic on a particular post comes from mobile devices, the mobile link will be indexed in SERPs instead of the normal link.

So what?

Well, after moving from Blogger to WordPress, there won’t be any PermalinkĀ difference between a normal desktop link and mobile link (unless you explicitly do something). That is because almost all the themes now are fully responsive and don’t require a separate template to be loaded for a mobile device (or any other device for that matter). And so, a link with the query string m?=1Ā will become invalid, leading to a 404 error.

Okay, how do we resolve this?

Read also:Ā 3 Ways to Eliminate your Website Downtime

It’s pretty simple. All you need to do is to add a rewrite rule to your blog’s .htaccess file. Remember, this should be the first rule if you have any other redirection rules. Here is the code:

Please take a backup of your current .htaccess file before making any changes to it. If in case anything goes wrong, you can revert back šŸ™‚

#BEGIN Redirecting old blogger links with query string i.e. *.html?m=1 to *.html
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{QUERY_STRING} ^m=1$
RewriteRule ^(.*)$ /$1? [R=301,L] </IfModule>
#END

2. Some Posts are not Properly Redirecting

In many cases, not all posts will be redirecting properly after migrating from Blogger to WordPress. In my case, I had some redirections done manually at Blogger earlier. And I had to add those redirect manually back on my WordPress. I’m usingĀ Eggplant 301 Redirects pluginĀ to handle all the 301 redirections on my blog. Though this plugin is not updated for 2 years, it still works fine. You can also use this plugin or search for any other plugin which allows adding permanent 301 redirections easily.

Read also:Ā Top 5 Free Responsive WordPress Theme 2017

3. You want to change the Permalink Structure

After migrating from Blogger to WordPress, I wanted to change the permalink structure as well. The Blogger permalinks containĀ Year and Month. E.g. http://yourdomain.com/2012/08/blog-post.html. I wanted to remove the year and month from the URL and make it likeĀ http://yourdomain.com/blog-post.html.Ā The latter looks cleaner and better than the former.

You can also change the permalink structure of your existing WordPress blog this way.

Now the question is, how do we do that? If we change the permalink structure on WordPress (Settings > Permalinks) as desired, it will work for all future articles. But what about the existing once? Yes, they all will lead to 404s. Now, you cannot add manual 301 redirects for all the existing posts if the number of posts is too big.

Well, don’t worry. I have a solution for this too. We have to add one more rewrite rule in the .htaccess file, and boom!

#BEGIN Removing year and month from the URL
<IfModule mod_rewrite.c>
RewriteEngine on
RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/([^/]+).html$ http://www.yourdomain.com/$3.html
</IfModule>
#END

The above rule will remove the year and month from the URL through the Regex. Simple enough, isn’t it?

Note: You have to change your WordPress’s permalink structure to http://www.yourdomain.com/blog-post.html. To achieve that, you can set the permalink setting to http://www.yourdomain.com/%postname%.html.

You may want to have a different permalink structure than the one I have shown above. I have just used my blog’s permalink structure for example. In case you want a different structure, you have to modify the rules accordingly.

Also Read:Ā Google AdSense Approval Guide 2017

Also, you can combine the rules together in a single module. E.g. We can combine above two redirection rules as follows:

#BEGIN Redirecting
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{QUERY_STRING} ^m=1$
RewriteRule ^(.*)$ /$1? [R=301,L]

RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/([^/]+).html$ http://www.yourdomain.com/$3.html
</IfModule>
#END

Great! We are done. Now all your blog posts should be redirecting properly and there shouldn’t be any 404 error. However, keep an eye on Google analytics and see if you are getting any such error. If so, make necessary redirections. Also, don’t forget to generate a fresh sitemap for your blog and submit to webmaster tools.

Free Download GenMag Pro Genesis Child Theme [Limited Time]

Hope this would be helpful. Please let me know if you want any further help in setting up these redirections or if you are facing any issue in implementing these rules.

About the Author: Vishal Jain

An IT Geek, Tech Blogger and Software Engineer. Love to Blog, Code and Design Web Interface.

3 Comments

  1. Thank you for this info.

    I will be moving out from blogger this night. Please, how’d i make the permalink structure be /%postname%/ instead of /%postname.html

    Tell me the modified code to use in my .htaccess file

    Looking forward to hearing from you. Urgently needed

    1. Hi John, thank you for stopping by. You can try the following code for your requirements


      #BEGIN Removing year and month from the URL

      RewriteEngine on
      RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/([^/]+).html$ http://www.yourdomain.com/$3

      #END

Leave a Reply

Your email address will not be published. Required fields are marked *