My server uses a custom 404 page. Is't possible to get 404 server response on a direct request of 404 page? Now: URL: http://mydomain.xxx/404.php HTTP/1.1 200 OK Server: nginx
200 response on Nginx 404 error page
Asked Answered
you can simply do
error_page 404 =200 /404.php;
Do I have to specify /404.php? I'd like to keep the current page but just do a 200 error. –
Varices
Serve /404.html content preserving original URL (404 status code).
server {
error_page 404 /404.html;
location = /404.html {
internal;
}
location / {
try_files $uri $uri/index.html $uri.html;
}
}
© 2022 - 2024 — McMap. All rights reserved.