Configure Nginx to ignore a path in url

4.5k Views Asked by At

My website is at /root/website/, in it there is a folder static for static files, when the user visit: /static/dfd99a5/xxx.js, I wish to serve /root/website/static/xxx.js, how can I do this in nginx?

1

There are 1 best solutions below

0
cnst On BEST ANSWER

You can use the rewrite directive like so:

location ~ ^(/static)/[0-9a-f]+(/.+)$ {
    rewrite ^ $1$2 break;
}