Z
Z
Zoron872019-01-20 11:58:00
Nginx
Zoron87, 2019-01-20 11:58:00

How to compose a regular expression for try_files nginx?

Please tell me how you can specify the path to the desired file in try_files in nginx for wp-rocket to issue static. files in wordpress.
The latest wp-rocket builds a footprint. path to static file -
wp-content/cache/wp-rocket/site.com/sterilisation-kitten/q=%2fsterilisation-kitten%2f/index.html
the wp-rocket manual contains the following. code for nginx:
location / {
try_files /wp-content/cache/wp-rocket/$http_host/$cache_uri/index.html $uri/ /index.php?$args;
}
but nginx doesn't see it. there is another folder "q=%2fsterilisation-kitten%2f"
If I do this:
location / {
try_files /wp-content/cache/wp-rocket/$http_host/$cache_uri/q=%2f$cache_uri%2f/index. html $uri/ /index.php?$args;
}
does not work :(
Please tell me how to do it right. Or just how to use a regular expression like take any folder ".*"
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
Zoron87, 2019-01-21
@Zoron87

The problem is that $cache_uri contains / instead of %2f. How can I remove slashes from a variable, or how can I prevent nginx from converting / to %2f when saving?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question