Blogger to WordPress:  Fixing Mobile Links

Blogger to WordPress: Fixing Mobile Links

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.

Scott

About Scott

A former manufacturing executive, Scott now balances his family life with ownership and backend administration of websites such as SahmReviews.com, GiftCardCollector.com and a number of other online properties. He also is an occasional writer and full-time board game fanatic.

35 comments on «Blogger to WordPress: Fixing Mobile Links»

  1. Holly says:

    I made the switch to wordpress from blogger a long time ago but it would have been so helpful to be able to fix the mobile links.

  2. Nice! Going to save this in case I need it or someone asks me for it, I can look like a smarty-pants!

  3. Jenn says:

    Kudos to you for understanding this stuff. I hired a professional for my migration so I wouldn’t screw it up!

  4. Michelle says:

    Good info to have! Thanks!

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

  6. Tonya says:

    I love your tutorial, but I’m always terrified to mess something up and afraid I won’t know how to fix it.

  7. Cat Davis says:

    That’s a great resource. I started on Blogger YEARS ago and lost a lot of links when I switched over.

  8. Melinda says:

    i hired someone to work on my transfer. I just don’t understand the backend tech stuff.

  9. Thanks for the info. I am still on blogger and still nervous about making the leap. This gives me hope.

  10. trisha says:

    There is nothing more frustrating than blogger to wordpress. I am sure you just made someones day!

  11. Beeb says:

    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.

  12. Ahhhh, a ground that scares the average blogger. I love that people that know what they are doing make great tutorials for a smooth update. Thanks!

  13. Digna D. says:

    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. Scott says:

      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/

  14. My migration was seriously botched by the company I hired to do it. I got recommendations and everything and the damage they did took over a year to fix!

  15. Great tips! When I moved from Blogger I wish I would have had these tips.

  16. Where was this post when I moved over 2 years ago? This would have been so nice to have. What a great resource!

  17. BlogDaz says:

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

  18. 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. Scott says:

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

  19. I did download the file before I modified it, just in case. 🙂

  20. Daniel says:

    Hi, i have tried to add those lines to my .htaccess but it does not work.
    I have restarted nginx also…please help…

  21. We had to the change the URL structure in the middle of the development, nothing worked but this. Thanks a lot.

  22. Fantastic post. We have to channge the url and structure and developed it.

  23. John says:

    Really excellent content

  24. Anthony says:

    Great piece of idea. Thanks for the insiders.

  25. Wright says:

    Good info to have.Thank you so much buddy.

  26. Jan says:

    Thank you so much, this thing was killing me for weeks!

  27. I know this is an old post but it was so helpful! I just switched my site over yesterday and my mobile links weren’t working, and the old blogger redirect plugin is outdated – this worked perfectly.

    1. Scott says:

      Glad to hear it worked out for you! Switching can be so daunting!

  28. 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. Nevermind! I just stuck it in as the very first IfModule and it worked! Thank you SOOOOOO MUCH!!! 🙂

      1. Scott says:

        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.

  29. Eugene says:

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

    1. Scott says:

      There are ways to do it, but they’re messy. Some of them are covered here – https://stackoverflow.com/questions/19583754/is-it-possible-to-rewrite-a-url-without-htaccess-file

      Your best solution might be Javascript. Might be easier to talk to your provider about leaving the htaccess file alone!

Leave a Reply

Your email address will not be published.