A
A
Absolute1382019-12-14 19:57:16
Nginx
Absolute138, 2019-12-14 19:57:16

How, if the picture has a GET parameter, to give another one?

Sorry for the noob wording, but I don't know nginx at all.
The bottom line - there are pictures, a lot, an example:

/upload/000/u1/7/1/1.jpg?moderation=on
/upload/001/u2/5/4/25.jpg
/upload/002/u88/2/2/34.jpg?moderation=on

As if there is a GET parameter moderation=on - give a stub instead of a picture:
/upload/system/no-avatar.jpg
I tried this construction found in the open spaces:
location ~* ^.+.(jpg|jpeg|gif|png|svg|)$ {
    if ($arg_moderation) { 
    rewrite /upload/system/no-avatar.jpg break;
    }
}

...the compiler complains

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2019-12-14
@Absolute138

location ~* \.(jpe?g|gif|png|svg)$ {
    if ($arg_moderation = "on") { 
        rewrite ^ /upload/system/no-avatar.jpg break;
    }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question