It’s been just over a month since our grand makeover and so far everything (almost) has gone rather smoothly. Well, except for the PG-13 ads that Google decided to serve up on one of our Disney posts… For those of you wanting to make the switch from Blogger to WordPress, the unequivocal answer is “Yes, it is worth it”. While Blogger has made strides over the years to make their back end more user friendly, there was still just something about it that made it feel constrained. With WordPress it just feels like the sky is the limit.

There are many things to consider when making the migration and a Google search will lead you to many great tutorials about importing your old data, fixing links, etc. Read them, then read them again. Make sure you understand what is happening in the background before you begin the process. One of the biggest issues you’ll face is the fact that the URL’s will change and you need to address it in order not to lose all your links and Google page ranking.

There are plugins that help with this issue, but we chose the long road and MANUALLY changed every permalink to match that of Blogger. We had a dedicated URL on Blogger so this was possible. If you are just now purchasing your own domain then obviously this solution won’t work and you’ll need a robust redirect plugin such as Blogger 301 Redirect.

But that’s not what this post is about.  This post is to document a small issue we encountered that most people who migrate from Blogger (with their own domain) to WordPress experience.  It has to do with external links from Pinterest, Instagram, etc.  Because these links were usually made via a mobile device, the Blogger URL typically had a “?m=1” appended to the end of it.  This is simply Blogger-code for ‘mobile’ and let them know how to handle the link. But WordPress chokes when it sees it (Hello 404 error) and now you’ve lost all of that Pinterest and Instagram traffic.

During our searches we found a very promising solution that seemed to fix the issue. What it does is check the URL on the server-level before WordPress gets a hold of it to determine if it should alter it.  This is what we added to our .htaccess file:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} .
RewriteCond %{QUERY_STRING} !^(s|p)=.*
RewriteCond %{REQUEST_URI} !.*wp-admin.*
RewriteRule ^(.*)$ /$1? [R=301,L]
</IfModule>

It strips out everything after the question mark, but properly ignores anything in the wp-admin directory so your admin interface will still work.  We tried this as posted, but noticed issues a couple days later. Some of our plugins weren’t working correctly (or at all), so we added the following lines after the wp-admin line:

RewriteCond %{REQUEST_URI} !.*wp-content.*
RewriteCond %{REQUEST_URI} !.*wp-includes.*

Again, our thinking was to only limit the script to the root WordPress directory.  This fixed our issue! Or so we thought… Turns out something else wasn’t working – scheduled posts! Oh no! This is a critical part of WordPress and one that must be fixed right away. I had an idea…

Realizing we don’t need to strip everything, just URLs that come from Pinterest or Instagram with the mobile tag, the solution turned out to be rather simple. Instead of using the code above we simplified it to this code:

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

Now any time a URL comes in with “?m=whatever” the script will strip it off and just leave the base URL. This solution may not be for everyone, especially those that run a separate mobile template, but for 99% of us it is a simple fix for those pesky Pinterest and Instagram URLs.

35 thoughts on “Blogger to WordPress: Fixing Mobile Links

  1. I started SensiblySara on WordPress, and I am SO GLAD I did! (I had a blogger blog before that and couldn’t really get into it.)

    The backend isn’t anything I can (or want to) do – so I always hire it out.

  2. Thanks for sharing this awesome tutorial! I’ve bookmarked it – I switched to WP in 2010 so I’ll have to dig back and see how those old links translate on mobile.

  3. Interesting information. I didn’t know this. I moved from blogger to WordPress last year. However, I didn’t have any mobile links. I used a plugin and had no problems. And yes, I lost my ranking for about 6 months. I was lucky, as many don’t regain their ranking for a full year. The only problem with the plugin is you need to change the photo links manually. Still working on mine a year later. 🙂

    1. Glad to hear your migration went well. I probably didn’t explain it well enough in the article as we didn’t have any mobile links either.

      When someone pins to Pinterest from a mobile device, Pinterest adds the ?m=1 to the URL since that’s the link Blogger gives them when someone views it on a mobile device. Blogger handled it nicely, but WordPress doesn’t like it. So…it must be stripped when someone clicks on it via Pinterest and tries to come to your WordPress site.

      Here’s an example of one of our pins from the old site that needed fixing: http://www.pinterest.com/pin/367113807096244177/

  4. 2 days wasted looking for a solution to blogger mobile redirect, I’m loathe to mess with files. Anyway I thought I’ll have one more search, came across this page and thought “oh waht the hell”, I made a backup, added your code to htaccess, VOILA, no crash, no white screen of death, it worked, now I can remove all those 404 errors cause by that blasted html?m=1.
    THANKS, I mean many thanks….

  5. Thank you, thank you, THANK YOU! The Blogger redirect plugin I installed was supposed to take care of the mobile issue, but it wasn’t redirecting those links despite me following the directions exactly. I was terrified to modify my .htpaccess file, but I did just as you instructed and the mobile tags are now being stripped. Yay!

    1. Glad it was of use Melissa! I too hate dealing with the .htaccess file, but sometimes it is just necessary. Just keep in mind your changes in case you have any issues with mobile access with your template (probably won’t, but you never know).

  6. Thanks so much for this post! IT’s EXACTLY what I was looking for! But here’s a dumb question: where exactly do i put the code in my .htaccess file? Does it matter? Thanks so much and happy 4th! 🙂

      1. Glad it worked out for you! As you probably found out, the location doesn’t matter too much, unless you’re doing other rewrites that might intercept it first.

  7. Unfortunately my hosting provider rewrites my changes to .htaccess
    Is any way to do this via plugin or something else?

Leave a Reply

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