简体   繁体   English

如何使用.htaccess在网址末尾删除'?m = 1'?

[英]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. 我刚刚将博客从Blogger移到了WordPress,并且移动网址出现了问题。

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. WordpPress具有设置URL结构的功能,因此桌面URL可以,但移动版本的Blogger URL中还有一个?m=1

This is what I'm trying to do: 这就是我想要做的:

redirect http://www.example.com/2016/05/artical.html?m=1 重定向http://www.example.com/2016/05/artical.html?m=1
to http://www.example.com/2016/05/artical.html 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]

Hope this helps just after RewriteEngine On 希望这在RewriteEngine On后有帮助

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM