Answer the question
In order to leave comments, you need to log in
How to give a 404 error at a specific URL in nginx
The problem is the following, there is a URL (the address of a specific page of the site), when accessing which you need to give a 404 error, you need to do this at the nginx level.
Answer the question
In order to leave comments, you need to log in
location =/someuri {
return 404;
}
location =/someuri {
if ($arg_page = 1) { return 404; }
# или (если вообще искать цифру 1 во всей части ссылки после ?
if ($arg ~* 1) {return 404; }
<здесь вставляем конфигурацию для обработки запроса к /someuri без page=1 или с другими аргументами, например строки про proxy_pass - скорее всего нужно скопировать из location />
}
What if there are question marks in the URL? Tell me what to do. In his absence, everything works, with him - no.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question