404 error page settings,Not only can it improve user experience,From the perspective of seo,It is also very important.Today, the author introduces here how to set a 404 error page under windows 2008.
1. Enter the windows 2008 server, open the iis manager, and click the website where you need to set a 404 error page.Enter the windows 2008 server, open iis manager, and click the website where you need to set a 404 error page.
2. Select the error page on the right of iis.Double-click to open.
3. An error page setting page appears.Today we only explain how to set 404,Such as 500, 503, etc. are not considered here.Double-click the 404 error page item,Or select the 404 item and click the edit button on the right
4. 404 error page setting option appears,I choose the first method,Enter the full path of the 404 static page file,Click OK below.
404 file path advantages and common environment
Usually it is a direct path.For example:
d:\ webroot \ 404.htm
(The system will locate the website root directory by default)
This is the more correct choice.What is returned is a 404 status page.It is very good for search engines,Basically there is no path is 404.
Applies to:web sites
404 Implementing URLs on this site
This is generally filled in
This is a normal file for search engines,The return status is 200. If cdn is used, the file will not be updated even if it is later expiredAlways this error page
Applies to:download stations or pages that need to jump (404 trigger event)
5. After completing the above operations,We can enter the wrong address of a page of the website into the browser,Test if you enter the set 404 error page.The author's test is no problem.After completing the above operations,We can enter the wrong address of a page of the website into the browser,Test if you enter the set 404 error page.The author's test is no problem.
6, test can open 404 error page,Does not mean that the set 404 error page is successful.From the perspective of seo, if your website http status code is 200 or 302, it is very unfriendly to seo,We need the website's http return status code to be 404. We can use the http status query tool to test the website's http return status code.As shown in the following figure, the website http status code successfully returns 404, and the 404 page is successfully set.
7. At the moment we are in the root directory of the website,You will find an extra web.config file.
<?xml version="1.0" encoding="utf-8"?><configuration> <system.webserver> <httperrors> <remove statuscode="404" substatuscode="-1" /> <error statuscode="404" prefixlanguagefilepath="" path="404.htm" responsemode="file" /> </httperrors> </system.webserver></configuration>
If it is a url method, it is as follows
<?xml version="1.0" encoding="utf-8"?><configuration> <system.webserver> <httperrors errormode="detailedlocalonly"><remove statuscode="404" /><error statuscode="404" path="/404.html" responsemode="executeurl" /></httperrors> </system.webserver></configuration>
if it exists
Let's share the correct way of setting up the 404 page.
Setting up a 404 page for a website is a very simple and common operation.Can enhance website user experience and meet seo requirements. Seemingly simple operation If you don't check carefully,It is easy to make mistakes.
In a word:you thought she was loyal to you,Actually it has been derailed.
A 404 page is set but a 200 status code is returned:
The website has set up a 404 template page,But the returned http status code is 200. Why is this happening???
Maybe you find it strange here."The http status code that the 404 page should return is 404!" I thought so at first,But not all right.
Harm to the website:
Although a 404 page is returned to the user, it is a normal page for search engines.This is often a 200 status code returned due to incorrect server-side configuration, although for users who visit,It does not make a difference whether the http status code is "404" or "200".The same is to improve the user experience,But for search engines,This is very important,Even fatal.
When a search engine spider gets a "404" status response when requesting a wrong URL address,Knowing that the url address has expired,The page is no longer indexed.And feedback to the data center that the web page indicated by the url address is deleted from the index database,When the search engine gets a "200" status response to this 404 page,Will consider the url address to be valid,Will go to the index,And will be included in the index database,In this way, all your error pages are the same pages with different URL addresses for search engines.This can cause a lot of duplicate pages,Will greatly reduce the quality of the site,Even directly downgraded.
So a properly set custom 404 error page,Not only should it be displayed correctly,At the same time, a "404" error code should be returned,Instead of 200 or something.Not only to tell the user that the page does not exist,Also let the search engines know that this is a 404 error page and not a normal page.
Because there is an error page setting in iis6/7,The 404 setting option has two response operations:file and url. What is the difference between these two operations?What are the different effects of different settings?
Setting up a 404 page
1. When the response action is selected:when performing url on this website. Will cause a 404 page template to be set,On the surface it looks right,But it is actually wrong;Because the http status code returned when visiting a non-existent page is still 200.
Reason:Because the operation is performed on a URL, the IIS server just reads another existing URL. Because this URL exists, the status code returned is 200.
If the site happens to have a lot of 404 pages, but the status code is wrong at this time,Will cause great harm to the website.
Set up a 404 page
But the http status code is 200
And accessing the non-existing URL returns a 404 page (but the status code is 200)
2. When the response action is selected:file path (absolute path). Although the http status code is 404, it will cause the IIS server to fail to read the 404 page template.In other words, the preset 404 template page cannot be read.
Setting up a 404 page
Failed to read 404 template
http status code is 404
3.The correct setting method is:
Set 404 page template to use relative paths
The status code returned by the page is 404
The returned page template is also a 404 template
PS:I found this problem when I was operating the server and website.And record and share it,WrongHope correct me.
- IIS 75 HTTP error 4043-workaround for Not Found error
- IIS custom 404 error pages to avoid exposing NET website path information
- Graphic tutorial for setting 404 error page under IIS 85
- Setting a custom 404 error page under IIS 85
- Setting 404 error page under IIS 85 under win8
- IIS HTTP error 40417-not found workaround
- python - you may need to restart the kernel to use updated packages error
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- dart - flutter: the instance member'stars' can't be accessed in an initializer error
- i want to call a child component method from a parent in vuejs
- python 3x - typeerror: 'method' object is not subscriptable
- sh - 'apt-get' is not recognized as an internal or external command, operable program or batch file