重写nginx削减最后一个位置

时间:2014-11-18 03:49:51

标签: nginx rewrite

我想将以下网址http://example.net/bar/foo重写为http://example.net/bar

你知道怎么做吗?

1 个答案:

答案 0 :(得分:0)

使用此:

location /bar {
    rewrite ^/bar/(.*)/[^/]+$ /bar/$1;
}