开发者

NGINX rewrite for static dir

I'm trying to translate:

mydomain.com/98387634/image/file.png

to:

mydomain.com/image/file.png

Can anyone tell me wh开发者_高级运维at's wrong with my rewrite?

rewrite ^~/static/(.*)/(.*)$ ~/static/$2 last;

location ^~/static {
        expires max;
        root /var/www;
}


By default, *' AND+' in regular expressions are greedy. You must use `.*?' or write rewrite something like this:

rewrite ^~/static/[^/]*/(.*)$ ~/static/$1 last;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜