P
P
Pista2021-05-24 15:34:26
Nginx
Pista, 2021-05-24 15:34:26

How to not display an Nginx error_page error page on a specific url?

The domain behind cloudflare, if there is an error on the server, it will show a stub with an error code from Cloudflare, but I need to show my page, so I solved the issue with the nginx rule Below.

error_page 500 501 502 503 504 505 =200 /50x.html;
location = /50x.html {
root /etc/nginx;
}

However, if there is an error requesting the page site.ru/wp-admin/ then I don't need to apply the rule. How to write it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
4
4X_Pro, 2021-05-25
@Pista

Write a separate location for this address:
location =/wp-admin/ {
// here we write what needs to be done, for example, display our own error page instead of nginx's
error_page 500 501 502 503 504 505 /my_error_page.html;
// or redirect the user somewhere far away
return 301 4xpro.ru ;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question