修改 httpd.conf,找到:

 #ErrorDocument 500 "The server made a boo boo."
 #ErrorDocument 404 /missing.html

httpd.conf中的这一部分,#ErrorDocument 404 /missing.html 是显示错误页信息的,去掉前面的#,修改为:
 

ErrorDocument 404 /missing.html

 在网站根目录新建missing.html文件


1.切记不要将404错误转向到网站主页,否则可能会导致主页在搜索引擎中消失。如果一个 404 页面的内容小于 512b,IE 会认为该 404 页面不够友好,在 IE 下将不会成功返回该 404 错误页面。

2.切记不要使用绝对URL。例如:http://www.ekkj.cn/404.php。正常情况返回的是 404 状态码,而使用URL形式则返回的是 200 状态码。