Wordpress/Redirection plugin - how to redirect migrated blogger=>Wordpress.com `?m=1` links?

90 Views Asked by At

I've migrated (Google) Blogger blog into Wordpress.com. The blog is rather large (300+ posts) and I still get 404s multiple times a day due to URLs ending with ?m=1 query param.

e.g. https://softwarearchiblog.com/2019/01/technical-debt.html?m=1

will yield HTTP 404, while

https://softwarearchiblog.com/2019/01/technical-debt.html

works fine

I use the Redirection Plugin, which does a fairly good job for various other issues - but I can't define a proper expression in its language.

The issue is around not being able to define the target URL as a regex: enter image description here

  • Is there any way around it?

  • Is there any other plugin that will "do this work" and can live side-by-side with Redirections?

  • Since I work with hosted Wordpress.com - I understand I cannot modify the .htaccess file for a more generic redirect. Any other way to do it?

2

There are 2 best solutions below

1
On

With the Redirection Plugin you can ignore the query parameters:

https://redirection.me/support/matching-a-url/

But I think you'll need an entry for each of your posts.

0
On

I think, it's possible to do using javascript. You might put this code in the header.php or 404.php file (it depends on your theme) or use this plugin to insert the code Insert Headers and Footers

<script type="text/javascript">
        var uri = window.location.toString();
        if (uri.indexOf("&m=1", "&m=1") > 0) {
            var clean_uri = uri.substring(0, uri.indexOf("&m=1"));              
            window.location.replace(clean_uri);
        }
        var uri = window.location.toString();
        if (uri.indexOf("?m=1", "?m=1") > 0) {
            var clean_uri = uri.substring(0, uri.indexOf("?m=1"));
            window.location.replace(clean_uri);
        }; 
</script>