Answer the question
In order to leave comments, you need to log in
How to change url in location of nginx config?
Hello! The question is this: it is necessary to change the extension of pictures to webp in the wp-content folder and in subfolders, now the extensions are changing starting from the parent public_html folder, here is the code (angle brackets replaced with%, otherwise it is filtered before publication):
map $http_accept $webp_ext {
default " ";
"~image\/webp" ".webp";
}
map $uri $file_ext {
default "";
"~(\.\w+)$" $1;
}
server {
location ~* "^(?%path%.+)\.(png|jpeg|jpg)$" {
try_files $path$webp_ext $path$file_ext =404;
}
you need to implement something like this:
location ~* "^(?%path%wp-content.+)\.(png|jpeg|jpg)$" {
try_files $path$webp_ext $path$file_ext =404;
}
Answer the question
In order to leave comments, you need to log in
How to change url in location of nginx config?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question