Answer the question
In order to leave comments, you need to log in
Is it possible to fix this Nginx rule? If so, how?
Hello.
There is an Nginx rule, it should work exactly like this. Naturally, it doesn't work, because in the configuration of this web server it is forbidden to insert the logical construct If inside the Location , as well as vice versa. In any case, the built-in checker ( nginx -t ) pointed me to this oversight and illiteracy.
location ~* ^.+\.(jpeg|jpg|png|bmp)$ {
...
if ($img_extension = ".webp"){
location ~ /image-content/(.*) {
add_header 'Content-Type' 'image/webp';
try_files $uri /image-content/webp/image-content/${1}${img_extension} /webp-gen.php?source=$document_root$request_uri&image-content=image-content&$args;
}
}
...
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question