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;
精彩评论