
最近在迁移博客( wordpress→静态页面),迁移后页面链接会有所变化,所以打算做个 301 重定向。 下载了相关的插件,不过楼主小白不会用。。特来咨询以下的问题:
原链接 https://xxx.com/blog/%postname%.html 新链接 https://xxx.com/post/%postname%.html
如果把原链接通过 301 重定向为新的链接,postname 这个变量需要用正则写么?如果需要的话,请问该怎么写呢?
求答案,
1 InDom 2022 年 6 月 24 日 rewrite ^/blog/(.*)\.html$ /post/$1.html permanent; 也许,可以不需要插件。 |
2 Superoutman OP PRO @InDom #1 请问这个是要写在哪里呢 |
3 PEAL 2022 年 6 月 24 日 @Superoutman nginx |
4 novolunt 2022 年 6 月 24 日 页面上请求内容也需要替换 sub_filter '/blog/' '/post/'; sub_filter_once off; sub_filter_types application/Javascript text/css text/Javascript application/json text/plain; |
5 Superoutman OP PRO @PEAL #3 Wordpress 用的是 Apache ,我是应该写在 .htaccess 里吧? |
6 Superoutman OP PRO @novolunt #4 好的,感谢。就是不知道把这些写在哪里,hhh |
7 wdssmq 2022 年 6 月 24 日 这个插件目测要专业版才能有匹配模式? |
8 wdssmq 2022 年 6 月 24 日 RewriteRule ^blog/(.*)\.html$ /post/$1.html [L,R=301] |
9 Superoutman OP PRO |