How To Redirect Blogspot URLs for WordPress

WordPress Logo

One of the many minor annoyances when moving from a free Blogger/Blogspot blog to a WordPress blog is that the URLs are made slightly differently. (The URL is the address that you type into the field at the top of the browser.)

There are three reasons this is a problem:

  1. Blogger ends all URLs with .html, and WordPress doesn’t.

  2. Blogger also drops “a” “and” and “the” from titles when building the URL.

    So for instance “The best way to peel a grape” would become “http://sitename.com/best-way-to-peel-grape.html” That same post in WordPress becomes “http://sitename.com/the-best-way-to-peel-a-grape/”

  3. Finally, if there are “too many” words in the URL Blogger will just cut off a few words. I haven’t seen them ever publish the exact criteria, so it’s kind of hard to plan for.

The first issue — dropping the “.html” — can be fixed for all posts with a single rule. The other two need to be fixed with a special rule for each one.

For the general rule, you need to be able to modify your ‘.htaccess’ file. (This is for Linux servers. Sorry, I don’t do Windows.)

The changes

In the .htaccess file, add this at the top.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)\.html$ http://sitename\.com/$1/ [R=301,L]
</IfModule>

The “RewriteRule” says take anything between the site name and the “html” (the red part) and put it after the site name with a trailing slash (the green part).

If you have any posts where Blogger/Blogspot dropped some words, so the URL doesn’t match the title, you’ll need to do one-by-one fixes, like this:

RewriteRule ^.*how-to-peel-grape\.html$ http://sitename\.com/how-to-peel-a-grape [R=301,L]

That says to take any request that ends with “how-to-peel-grape.html” and instead point it to “how-to-peel-a-grape”. Create a version of this line for each post you need to manually fix. (Each rule should be all on one line.)

Place all these one-off rules just before the generic RewriteRule. That way it checks the one-off rules first, then if nothing has matched yet it drops the .html and points to the correct URL.