The 404 page should be familiar to webmasters, and its role is to improve user experience and enhance search engine friendliness. Last year, when I was chatting with a few friends, I was told that 404 pages should not be set casually. Websites that are not set up well will be severely demoted. I didn’t pay much attention at the time. A few days ago, I was communicating with colleagues at Laggard and I said, " Please pay attention to your return status code" reminded me that I need to study 404 in depth.
At present, many websites have set up 404 pages, but few of them are really set correctly and appropriately. They mainly focus on errors in returning status codes, almost all of which are 200 or 301. You can use the tool HttpWatch. Go and check (this tool is a bit complicated, http://www.seobox.org/getheader.htm is also a good online tool).
Regarding how to set up 404 on the server, you can go to Baidu, and a lot of results will appear in a search. So how should virtual host users set it up? First, your access provider must provide the function of free setting. If not, communicate with the access provider. . We design a 404 page on our homepage, just like an ordinary page. For example, we can place website navigation and some friendly words to inform the user that the currently searched page does not exist, etc., and then save this page as an asp dynamic form (php dynamic has not been tested yet, There is no solution for the static page yet). If we test this page, we will find that the returned status code is 200. At this time, we need to impose a code in the head:
<% Response.Status ="404 Not Found" %>
Save the page and check it with a tool. Do you find that the prompt at this time is 404?
Post the code I wrote:
Test results:
Code demonstration: http://www.rdzikao.com/404/index.asp