This article mainly introduces the solution to the problem of returning to the error page when the http status jumps in ASP. Interested friends can refer to it.
The default error page of IIS is very unfriendly. Many people will say when they see the default error page: The website cannot be opened! This part of the traffic was lost in vain. If the error page jumps directly to the homepage and is not friendly to search engines, the homepage may be blocked. So depending on the situation, there are two ways to solve this problem:
If it is a content-type website such as a blog, you can return a search box with 404 errors for visitors to search. If it is an e-commerce website, you can return a progress bar with 404 errors for jump. These two methods take care of visitors and take into account SEO.
You can check how many error pages of your website are in Google webmaster tools.
The method to modify the default error page is very simple: right-click the website you want to manage in IIS, and set 404 as the corresponding error information page in the custom error. Here are two ways:
1. If you choose a file for the message type, you can only use files ending with .html or htm, otherwise the code will appear when the user accesses the error page. In the error page set in this way, although the 404 status is not output in the .html file, the 404 status will be automatically output after IIS execution.
2. If you select the URL for the message type, you must use the asp file (because the 404 status can only be set in the asp file), otherwise 200 status code will be returned when accessing the error page. Also add:
Copy the code as follows: <%Response.Status = 404 Not Found %>If you want to jump to the homepage regularly, there are two ways :
1. Use the refresh of the meta tag to jump
The code copy is as follows: <meta http-equiv=refresh content=3;url=http://www.vevb.com>2. Use js to jump
?
- <scriptstyle=text/javascript>
- setTimeout(testTime(),2500);
- functiontestTime(){
- location=http://www.vevb.com/;
- }
- </script>