![Nginx 重写 URL](https://linux22.com/image/596412/Nginx%20%E9%87%8D%E5%86%99%20URL.png)
我正在尝试从此 URL 中获取user-name
and account_id
(示例末尾的数字“1”)
我试过这个规则,但我无法得到account_id
rewrite ^/desinger/(.+)_([0-9]+)$ /index.php?m=USER&hdn_account_id=$2 last;
答案1
rewrite ^/desinger/(.+)_([0-9]+)$ /index.php?m=USER&hdn_account_id=$2 last;
你的正则表达式中缺少 .html,它应该是
rewrite ^/desinger/(.+)_([0-9]+).html$ /index.php?m=USER&hdn_account_id=$2 last;