How to set up a high-quality 404 page: 1. Set up the 404 function in the virtual space; 2. Set up the 404 page under IIS and set the corresponding error message page for 404; 3. Set up the 404 page under Apache , open the htaccess file and enter the "ErrorDocument 404 /notfound.php" code.
Two major benefits of setting up a 404 page:
1: Guide users not to close the website, but to return to the homepage or browse Other pages of the website to enhance user experience.
2: Prevent dead links from appearing on the website, which is beneficial to spider crawling and website inclusion.
How to create a high-quality 404 page?
The setting method of the 404 page is as follows:
1. Set up in the virtual space. The current space basically provides the 404 function. Set the page directly. After that, upload is enough.
2. Set up the 404 page under IIS. Right-click "Website to be managed" in the IIS manager, open Properties - Customize Error Message, and set the corresponding error message page for 404, which can be a .html web page. type, it can also be the 404.php file type. It needs to be emphasized that in "Message Type", be sure to select "File" or "Default Value", and never select "URL", otherwise, the "200" status code will be returned.
3. Set up the 404 page under Apache. Open the .htaccess file and enter the following code in it: ErrorDocument 404 /notfound.php. It should be noted that do not use absolute URLs. If you use absolute URLs, "302" or "200" status codes will be returned.
The above is the detailed content of How to create a high-quality 404 page?. For more information, please follow other related articles on the PHP Chinese website!