[英]Rewrite nginx cut last location
I would like to rewrite the following URL http://example.net/bar/foo
to http://example.net/bar
. 我想将以下URL http://example.net/bar/foo
重写为http://example.net/bar
。
Do you know how to do this ? 你知道怎么做吗?
Use this : 用这个 :
location /bar {
rewrite ^/bar/(.*)/[^/]+$ /bar/$1;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.