之前用的wordpress搭建博客,对于网址没有做设置,用的默认的/?p=XXXX形式,后来转到hexo,想对之前的链接做下301跳转,网上查了查,使用如下方法可以实现
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} p=(.*)
RewriteRule (.*?) /article/%1.html [R=301,L]
</IfModule>
但是有一个新的问题,当我访问
http://www.yangyanxing.com/?p=1350
的时候它是301跳转到
http://www.yangyanxing.com/article/1350.html?p=1350
不明白?p=1350为什么也加在了后面,要如何写htaccess来去掉它?