Wednesday 8 July 2020

Blogger to WordPress URLs (permalinks)

If you have ever migrated a blog from Blogger to WordPress you might be worried that the links to your articles won't work anymore. And you would be right to be concerned.

There are lots of complicated things to pay attention to when moving a website from one hosting company or platform to another. In this article I'm going to cover the very specific issues around Blogger's handling of links vs. WordPress' approach.

Having just moved the SE Labs Special Edition blog from Blogger to its new home on WordPress, we experienced and fixed some issues that you might also come across.

There are three main reasons that caused our new blog posts to have different URLs to the originals.
  1. Blogger adds a .html suffix to blog posts, while WordPress does not.
  2. Blogger uses the headline to create the URL, but removes words like, 'a' and 'the'. WordPress does not.
  3. WordPress uses the headline to create the URL and ignores custom permalinks created in Blogger.
Below are three real examples and our solutions:

1. Replace .html with /

Headline: Can Microsoft Solve Security?

Original Blogger URL

New WordPress URL

The fastest and most elegant solution is to use a WordPress redirection plugin called Redirection.

You could manually go through and create a separate redirection rule for every post but we had too many to justify that. Instead, a neat little rule using Regular Expressions (Regex) did the job for most (40 out of 70) of the posts we'd migrated. This rule is:
Source: ^/(.*?)\.html Target: /$1
Loosely translated, it says, "Read the original URL, remember the bit before .html and then load the web page that matches.

So in the above example, it reads the legacy Blogger link of:


removes the .html part and loads the WordPress article at


The .html is replaced with a forward slash (/).

2. Edit out the 'the's and 'a's

We had articles that contained words like 'a' and 'the' in the headline. Blogger removed these when generating the URL, while WordPress did not, as follows:

Headline: Securing a business from scratch

Original Blogger URL

New WordPress URL

Note that the original URL does not have the word 'a' in it, while the headline and the WordPress URL does.

The easiest solution for us was to manually edit the 'slug' for each WordPress article, removing the offending 'a' or 'the'. It's almost certainly possible to do this with Regex too. But, you know, time to master Regex vs. just getting it done...

At least our Regex rule from step #1 handles the .html part.

3. Replace custom permalinks

When we published reports, we customised the permalink to be a short code for the report in question. For example, when we published a set of endpoint protection (EPP) reports at the end of 2019 we used the code 2019Q4-EPP to represent the report type and the time period. This was not the same as the headline. Here's an example:

Headline: Testing deeper, wider and better

Original Blogger URL
New WordPress URL

No Regex that I can imagine is going to help much here. The obvious and unsubtle option is, again, to edit the slugs manually, replacing 'testing-deeper-wider-and-better' with '2019Q4-EPP'.

Again, at least our Regex rule from step #1 handles the .html part.

Footnote: You might notice that we have the month and year as part of the URLs. This is a Blogger default and we set WordPress to use the publication date to match that part of each link. It's in Settings - Permalink Settings and the option you want is called 'Month and name'. There is also a Custom Structure option that let's you specify all sort of things, including categories etc. That might be useful to you. Check it out!

No comments:

Post a Comment