最近网站经常被扫描不存在的文件,返回大量404页面,而本站主题自带的 404.php 页面索引所有文章,数据库查询次数和 cpu 占用过高,甚至被空间商警告一次,所以我把它改成了静态的404页面。
效果图(404页面):
代码如下:
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
- <title>您的访问出错了 - 小Z博客</title>
- <style type="text/css">
- body{margin:0;padding:0;font:14px/1.6 'Microsoft YaHei', 微软雅黑, Arial, Lucida Grande, Tahoma, sans-serif;background:#fff url(/img/line-bg.png) repeat-x;}
- a:link,a:visited{color:#007ab7;text-decoration:none;}
- h1{
- position:relative;
- z-index:2;
- width:540px;
- height:0;
- margin:110px auto 15px;
- padding:230px 0 0;
- overflow:hidden;
- background-image: url(/img/Main.jpg);
- background-repeat: no-repeat;
- }
- .link a{margin-right:1em;}
- .link,.texts{width:540px;margin:0 auto 15px;color:#505050;}
- .texts{line-height:2;}
- .texts dd{margin:0;padding:0 0 0 15px;}
- .texts ul{margin:0;padding:0;}
- </style>
- </head>
- <body>
- <h1>aaaaaaaaa</h1>
- <p class="link">
- <a href="/">◂返回首页</a>
- <a href="javascript:history.go(-1);">◂返回上一页</a>
- </p>
- <dl class="texts">
- <dt>我们正在联系火星总部查找您所需要的页面.请返回等待信息..</dt>
- <dd>
- <ul>
- <li>不要返回吗?</li>
- <li>确定不要返回吗?</li>
- <li>真的真的确定不要返回吗?</li>
- <li>好吧.还是随便你要不要真的确定返回吧</li>
- </ul>
- </dd>
- </dl>
- </span></span></span></p>
- </body>
- </html>
404 页面也很有爱的