动态404错误页面设置 首先,修改应用程序根目录的设置,打开 web.config 文件编辑,在其中加入如下内容: <configuration> <system.web> <customErrors mode=On
动态404错误页面设置
首先,修改应用程序根目录的设置,打开 “web.config” 文件编辑,在其中加入如下内容:
<configuration>
<system.web>
<customErrors mode=”On” defaultRedirect=”error.asp”>
<error statusCode=”404″ redirect=”notfound.asp” />
</customErrors>
</system.web>
</configuration>
注:上文例中“error.asp”为系统默认的404页面,“notfound.asp”为自定义的404页面,使用时请修改相应文件名。
然后,在自定义的404页面“notfound.asp”中加入:
<%
Response.Status = “404 Not Found”
%>
这样,便可以保证IIS能够正确地返回“404”状态码。
所有的设置完成之后,别忘记检测http状态,确定返回的是404,而不是200。
http状态检测,Server Header检查工具
http://www.seochat.com/seo-tools/redirect-check/