Teach you how to set up your own 404 pages in an IIS environment

Source: Internet
Author: User
Tags end iis modify return access
IIS default error page is very unfriendly, many people see the default error page will say: The site can not open! Lost this part of the flow in vain. And if the error page directly to the home page and search engine is very unfriendly, not good home will also be sealed off. So according to the situation, there are two ways to solve this problem:

The way to modify the default error page is simple: Right-click the Web site that you want to manage in IIS, and set 404 to the appropriate error message page in your custom error.

IIS default error page is very unfriendly, many people see the default error page will say: The site can not open! Lost this part of the flow in vain. And if the error page directly to the home page and search engine is very unfriendly, not good home will also be sealed off. So according to the situation, there are two ways to solve this problem:

If it is a blog and other content-type site, you can return a search box with 404 errors to let visitors search, if E-commerce site, you can return a 404 error progress bar to jump. Both of these methods take care of the visitors and consider the SEO.

You can see how many error pages you have on your site in Google Webmaster tools.

The way to modify the default error page is simple: Right-click the Web site that you want to manage in IIS, and set 404 to the appropriate error message page in your custom error. There are two ways of doing this:

1, if the "message type" you selected is "file", you can only use the. html or HTM end of the file, otherwise the user access to the error page will appear code. The error page that is set in this way, although the. html file does not output a 404 state, IIS automatically outputs 404 states after execution.

2, if you "message type" selected "URL", you must use ASP files (because only in the ASP file to set the 404 state), otherwise access to the error page will return a 200 status code. Also add the following in the ASP file:

<%response.status = "404 Not Found"%>

If you want to jump to the first page regularly, there are two ways to do it:

1, using the META tag of the refresh to jump

<meta http-equiv= "Refresh" content= "3;url=http://www.yahoo.com/?xxx" >

According to Google Chinese blog administrator, Yahoo on the use of this method to jump.

2. Use JS to jump

<script style= "Text/javascript" >
SetTimeout ("Testtime ()", 2500);
function Testtime () {
Location = "http://www.webjx.com/";
}
</script>

I feel the use of JS method better, because meta tags jump worry search engine will be identified as "200" or "302" see this paragraph here:

Often see a custom 404 error page for many web sites to take the form of first displaying an error message and then using Meta Refresh to jump the page to the home page, Sitemap, or other similar page. Depending on how it is implemented, such 404 pages may return "200" status codes, or "302 temporary redirects", but either way, from an SEO technical standpoint, is not an appropriate choice.

We have talked about the status of "200", so what will the search engine do when the 404 page returns "302"? Theoretically, for the "302" error, the search engine that the page exists, but temporarily changed the address, will still index the page, so that the same will appear similar to the "200" status code when the duplicate text problem; The mainstream search engine, which is represented by Google, is increasingly demanding 302 redirects, and this kind of improper use of the 302 redirect is a big risk.

Some points to watch on the Internet:

1, remember not to turn the 404 error to the homepage of the website, otherwise it may cause the homepage to disappear in the search engine.

2, remember not to use an absolute URL, if the use of absolute URL to return the status code is "302" + "200" (tested).

3, in the "message type" must choose "File" or "Default value", instead of selecting "URL", it will result in the return of the "200" status code (this is not the same as my own test, I chose the relative URL, the end of the Firebug test results are 404)



Related Article

Alibaba Cloud 10 Year Anniversary

With You, We are Shaping a Digital World, 2009-2019

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.