[英]Rewrite nginx rule for delete ID on url
I need write a rule for delete id on url post (wordpress) 我需要为网址帖子(wordpress)上的删除ID编写规则
https://myqite.com/12-title-of-post-one
https://myqite.com/45-title-of-post-two
https://myqite.com/56-title-of-post-nn
to 至
https://myqite.com/title-of-post-one
https://myqite.com/title-of-post-two
https://myqite.com/title-of-post-nn
Try several options but fail. 尝试几种选择,但失败。
rewrite ^([0-9]+)-(.+)$ $2 permanent;
Other 其他
rewrite ^([0-9]+)-(.+)$ $2 last;
After several test I get solution 经过几次测试我得到了解决方案
location ~ /([0-9]+)-(.+) {
return 301 https://$server_name/$2;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.