/usr/local/tomcat/apache-tomcat/conf/web.html指定如下内容

 
  
  1. <error-page> 
  2.   <error-code>404</error-code>  
  3.   <location>/error.html</location>  
  4. </error-page> 

在tomcat的主目录下面新建error.html文件,文件内容如下

 
  
  1. <html> 
  2. <head> 
  3. <meta http-equiv="Content-Language" content="zh-CN"> 
  4. <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312"> 
  5. <meta http-equiv="refresh" content="0.1;url=http://www.sina.com/index.html"> 
  6. <title></title> 
  7. </head> 
  8. <body> 
  9. </body> 
  10. </html> 

这样所有的404报错都指向了error.html页面,并跳转到http://www.sina.com/index.html