wordpress.htaccesshttp-redirect

How to use .htaccess to remove '?m=1' in the end of url?


I just moved my blog from Blogger to WordPress, and have a problem with the mobile URL.

WordpPress have a function to setup URL structure, so the URL for desktop is OK, but there is an additional ?m=1 in mobile version Blogger URL.

This is what I'm trying to do:

redirect http://www.example.com/2016/05/artical.html?m=1
to http://www.example.com/2016/05/artical.html

I tried this but it didn't work:

RewriteCond %{QUERY_STRING} ^(.*)(^|&)m=1(.*)$
RewriteRule ^(.*)$ /$1?%1%3 [R=301,L]

Solution

  • Hope this helps just after RewriteEngine On

    RewriteCond %{QUERY_STRING} ^m=1$
    RewriteRule ^(.*)$ /$1? [R=301,L]