This is because you are using the nginx web server program. Here we will introduce how to configure 404.
Steps:
1. Create a website 404.html page and store it in the website root directory.
2. Change nginx. conf and add fastcgi_intercept_errors on in the http definition area;
3. Change nginx. conf and add error_page 404 =/404.html in the server area in the website configuration; or error_page 404 = http://www.xxx.com/404.html;
4. Verify nginx. conf:/usr/local/nginx/sbin/nginx-t
5. Restart nginx to take effect:/usr/local/nginx/sbin/nginx-s reload
#502 and other errors can be configured in the same way.
Error_page 500 502 503 504 =/50x.html;
Note:
1. You must add: fastcgi_intercept_errors on. If this token is not set, creating 404.html and configuring error_page does not work. Fastcgi_intercept_errors syntax: fastcgi_intercept_errors on | off default: fastcgi_intercept_errors off add location: http, server, location by default, nginx does not support custom 404 error page, only this command is set to on, nginx supports 404 error redirection. Note that if fastcgi_intercept_errors on is set, nginx will redirect the 404 error. In nginx, the precondition for 404 error redirection to take effect is that fastcgi_intercept_errors on is set, and the error_page option is set correctly (including syntax and corresponding 404 page)