How to use .htaccess to remove '?m=1' in t

2019-07-08 11:24发布

问题:

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]

回答1:

Hope this helps just after RewriteEngine On

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