Answer the question
In order to leave comments, you need to log in
Why is replacement not working in nginx rewrite?
location / {
if ($args ~ "_escaped_fragment_=(.*)") {
rewrite ^ /snapshot/$1/index.html;
break;
}
try_files $uri $uri/ /index.html =404; # html5Mode
}
open() "/home/www/site.ru/public/snapshot//index.html" failed (2: No such file or directory),
request: "GET /?_escaped_fragment_=tools HTTP/1.1", host: "site.ru"
Answer the question
In order to leave comments, you need to log in
You expect $1 to be taken from the regex in the if, but it's actually taken from the regex in rewrite, i.e. empty
Use $arg_* variables. For example
rewrite ^ /snapshot/$arg__escaped_fragment_/index.html;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question