errorDocument 404 /404.html
2、IIS:Internet信息管理器-》网站-》属性-》自定义错误-》指定404页面,共有三种消息类型,默认值、文件、URL,默认值即返回404 Not found提示文字,选择消息类型为文件必须静态文件,动态文件不会被执行;url可指定asp、aspx等文件路径,可实现自定义页面执行相关代码实现特殊效果的功能(比如自定义404页面生成静态文件)。注意,使用URL消息类型时,必须在自定义页面中自行输出404错误状态,否则可能返回200状态。在asp页面中输出404错误方法见第4点。
3、PHP输出404状态,使用head头输出,在php文件相关位置加入下述代码
<?php
header("HTTP/1.0 404 Not Found");
?>
4、ASP输出404状态。
Response.Status = "404 Not Found"
5、ASP.Net自定义404错误页面,修改web.config文件。
<configuration>
<system.web>
<customErrors mode="On" defaultRedirect="error.htm">
<error statusCode="404" redirect="404.html" />
</customErrors>
</system.web>
</configuration>