The method to create a 404 page is: add the "ErrorDocument 404/Error.html" code to the ".htaccess" file; then create a simple html 404 page and name it "Error.html"; Finally, place the "Error.html" file in the root directory of the website.
The purpose of the 404 page is to tell the viewer that the requested page does not exist or that the link is wrong, and at the same time guides the user to use other pages of the website instead of closing the window and leaving. . Many open source systems, including CMS systems and Blog systems, do not provide 404 pages or the 404 pages they provide do not meet the requirements of SEO, which greatly reduces the authority of the website. So what effect should the 404 page achieve to meet SEO requirements?
#Search engines use HTTP status codes to identify the status of web pages.
When a search engine obtains a bad link, the website should return a 404 status code to tell the search engine to give up indexing the link.
If a 200 or 302 status code is returned, the search engine will index the link, which results in a large number of different links pointing to the same web page content.
The result is that search engines’ trust in the website is greatly reduced. Many websites have this problem: the 404 page returns a 200 or 302 status code instead of a 404 status code.
The correct method to create a 404 page is: (only suitable for Apache server)
Add code to the .htaccess file: ErrorDocument 404/Error.html
Create a simple html404 page named Error.html
Place Error.html in the root directory of the website
Note:
1. Do not redirect 404 errors directly to the homepage of the website, which will result in the homepage not being included;
2. Do not put the main domain name in front of /Error.html, otherwise the returned status code will be 302 or 200 status code.
The above is the detailed content of What to do with 404 page?. For more information, please follow other related articles on the PHP Chinese website!