Usually, when judging a nonexistent resource (such as category or product does not exist) through php, you need to return a 404 status through the header and display the corresponding 404 page. in the previous service
Usually, when judging a non-existing resource (such as category or product does not exist) through php, you need to return a 404 status through the header and display the corresponding 404 page. the method on the previous server is as follows:
- Header ('http/1.1 404 Not Found ');
- Header ('status: 404 Not Found ');
- Require ('2014. php ');
- Exit ();
However, after a new server is changed, it finds that some letters and numbers are garbled on the page. after checking, it is found that the communication protocol version is inconsistent with HTTP/1.1 in the code when the current server request page is displayed, to know the name and version of the communication PROTOCOL of the current server, use $ _ SERVER ['server _ protocol']. after testing, the http version of my SERVER is 1.0, so the code should be changed:
- Header ('http/1.0 404 Not Found ');
- Header ('status: 404 Not Found ');
- Require ('error. php ');
- Exit ();