![](/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.