WordPress 不带.html跳转到.html正则规则

2021-12-16
1,226次阅读
没有评论

由于刚做博客的时候,脑子不知想啥,把固定链接设置成了/%category%/%post_id%,没有带后缀。最近发现文章链接https://ylface.com/course/1479会跳转到分类页面去,之前没发现这种情况,最近突然就这样了。

最后把固定链接添加个后缀才解决/%category%/%post_id%.html,然后用正则做一个跳转

if ($request_filename ~ (.*)/(.*)/[0-9]*$){
    rewrite (/(.*)/[0-9]*$) $1.html permanent;
}

正文完
要饭中,多少给点吧(支付宝)
post-qrcode
 
评论(没有评论)
验证码