wong2
wong2

Reputation: 35720

Configure Nginx to ignore a path in url

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?

Upvotes: 3

Views: 4925

Answers (1)

cnst
cnst

Reputation: 27218

You can use the rewrite directive like so:

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

Upvotes: 2

Related Questions