![](/img/trans.png)
[英]NGINX Rewrite rule, passing part of the URL to PHP - Wishlist Member
[英]Rewrite nginx rule for delete ID on url
我需要为网址帖子(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
至
https://myqite.com/title-of-post-one
https://myqite.com/title-of-post-two
https://myqite.com/title-of-post-nn
尝试几种选择,但失败。
rewrite ^([0-9]+)-(.+)$ $2 permanent;
其他
rewrite ^([0-9]+)-(.+)$ $2 last;
经过几次测试我得到了解决方案
location ~ /([0-9]+)-(.+) {
return 301 https://$server_name/$2;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.