Mario
Mario

Reputation: 2021

Check name of file try_files

I'm trying to check if a file exists but the URL is not the same as the file's name. I mean, my URL is:

localhost/12/569.jpg?od=3

And I want to check if the file v12t569.jpg exists throught try_files on ngingx. Is it possible?

try_files /files/img/$uri ;

Thank you.

Upvotes: 0

Views: 1728

Answers (1)

VBart
VBart

Reputation: 15110

location ~ ^/(\d+)/(\d+\.jpg)$ {
    root /files/img;
    try_files /v$1t$2 =404;
}

Upvotes: 3

Related Questions