Answer the question
In order to leave comments, you need to log in
How to make an nginx redirect with a condition?
How to:
if example.com/static.* then 404
otherwise
return 301 https://myexample.com$request_uri ;
Trying to describe how in nginx:
server {
if ($host = example.com) {
if ($request_uri = "static.*") { return 404 ; }
}
if ($host = example.com) {
return 301 https://myexample.com$request_uri;
}
}
}
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