如何使用 .htaccess 删除 url 末尾的 '?m=1'? [英] How to use .htaccess to remove '?m=1' in the end of url?

查看:46
本文介绍了如何使用 .htaccess 删除 url 末尾的 '?m=1'?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚将我的博客从 Blogger 移至 WordPress,但移动网址出现问题.

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

WordpPress 有设置 URL 结构的功能,所以桌面的 URL 是可以的,但移动版 Blogger URL 有一个额外的 ?m=1.

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.

这就是我想要做的:

重定向 http://www.example.com/2016/05/artical.html?m=1
http://www.example.com/2016/05/artical.html

我试过了,但没有用:

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

推荐答案

希望在 RewriteEngine On

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

这篇关于如何使用 .htaccess 删除 url 末尾的 '?m=1'?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆