新建一個404報錯觸發的controller,javascript
在裏面添加error事件:css
添加相應的頁面代碼:<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>404錯誤</title>
<meta http-equiv="refresh" content="60;url=http://www.mycodes.net/">
<!-- content="60,即60秒後返回主頁,可根據須要修改或者刪除這段代碼 -->
<link href="../../css/error.css" rel="stylesheet" type="text/css" />
</head>
<body>
<!-- 代碼 開始 -->
<div id="container">
<img class="png" src="../../Images/404.png" /> <img class="png msg" src="../../Images/404_msg.png" />
<p><a href="http://www.law1268.com/" target="_blank"><img class="png" src="../../Images/404_to_index.png" /></a> </p>
</div>
<div id="cloud" class="png"></div>
<!-- 代碼 結束 -->
@*<script src="http://www.mycodes.net/js/tongji.js"></script>
<script src="http://www.mycodes.net/js/youxia.js" type="text/javascript"></script>*@
</body>
</html>html
在web.config上java
添加404觸發代碼:web
這樣就能夠了:ui