Answer the question
In order to leave comments, you need to log in
How to do such a rewrite in nginx?
I want to make such a redirect, I read that in nginx you can use the $request_uri variable (directive), I tried to do this:
server{
server_name www.site1.ru;
if($request_uri != robots.txt){
rewrite ^(.*) http://www.site2.ru$1 permanent;
}
}
Answer the question
In order to leave comments, you need to log in
Most likely it will be something like this:
if ($request_uri ~ "^/robots.txt") {
# или
# if ($request_uri != "robots.txt") {
rewrite ^(.*) http://www.site2.ru$1 permanent;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question