zblog程序的自定义404页面设置方法
关于zblog404页面的自定义设置方法
首先来说博客程序不管是zblog还是wordpress基本都是自带404页面的,所以没办法在htaccess设置或者空间服务商后台设置想要自定义博客404页面唯一的方法就是将原来的404.php模板内容替换掉,下面这个页面也是在别人哪里挖来的,如果需要可以复制到自己主题模板下的404.php文件内替换掉即可
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"/> <meta http-equiv="Cache-Control" content="no-transform"/> <meta http-equiv="Content-Language" content="{$language}" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> <title>对不起,页面未找到</title> <style type='text/css'> body{font:12px/1.5 'Microsoft Yahei',Simsun;font-size:14px;line-height:1.42857143;color:#333;background:#f5f5f5} .wrapper-page{width:420px;margin:7.5% auto;text-align:center} .page-ex h1{font-size:98px;line-height:150px;font-weight:700;color:#252932;margin:10px 0;text-shadow:rgba(61,61,61,.3) 1px 1px,rgba(61,61,61,.2) 2px 2px,rgba(61,61,61,.3) 3px 3px} .page-ex h2{font-size:30px;color:#505458;line-height:35px;margin:10px 0} .page-ex p{font-size:14px;color:#505458;margin:0 0 10px} input[type=text]{float:left;width:71%;position:relative;font-size:14px;color:rgba(0,0,0,.6);margin-left:-1px;margin-bottom:0;padding:12px 17px;line-height:1.3333333;background-color:#fafafa;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);-moz-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);box-shadow:inset 0 1px 2px rgba(0,0,0,.1);border:1px solid #eee;box-shadow:none;outline:0;z-index:2} input[type=submit]{width:20%;font-size:16px;font-weight:700;color:#fff;line-height:32px;padding:10px 16px;line-height:1.3333333;border-radius:6px;padding-right:15px;border:2px solid #BDBDBD;background:#BDBDBD;outline:0;cursor:pointer;background-color:#1e88e5;border:1px solid #1e88e5;border-radius:2px;letter-spacing:.2px;opacity:.93;-webkit-box-shadow:0 1px 2px 0 rgba(0,0,0,.1);-moz-box-shadow:0 1px 2px 0 rgba(0,0,0,.1);box-shadow:0 1px 2px 0 rgba(0,0,0,.1);-webkit-transition:all .3s ease-out;-moz-transition:all .3s ease-out;-o-transition:all .3s ease-out;-ms-transition:all .3s ease-out;transition:all .3s ease-out} .page-back{background-color:#7e57c2;color:#FFF;letter-spacing:.2px;opacity:.93;display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;border:1px solid transparent;border-radius:4px;text-decoration:none;-webkit-transition:all .3s ease-out;-moz-transition:all .3s ease-out;-o-transition:all .3s ease-out;-ms-transition:all .3s ease-out;transition:all .3s ease-out} .page-back:hover,input[type=submit]:hover{opacity:1;-webkit-box-shadow:0 2px 5px 0 rgba(0,0,0,.16),0 2px 10px 0 rgba(0,0,0,.12);-moz-box-shadow:0 2px 5px 0 rgba(0,0,0,.16),0 2px 10px 0 rgba(0,0,0,.12);box-shadow:0 2px 5px 0 rgba(0,0,0,.16),0 2px 10px 0 rgba(0,0,0,.12)} @media only screen and (max-width:767px){.wrapper-page{width:90%} } @media only screen and (max-width:480px){.wrapper-page{width:90%} input[type=text]{width:61%} } </style> </head> <body> <div class="wrapper-page"> <div class="page-ex"> <h1>404!</h1> <h2>对不起,页面未找到</h2><br> <p>找不到内容?尝试下我们的搜索吧!</p> <form name="search" method="post" action="{$host}zb_system/cmd.php?act=search"> <input type="text" name="q" size="11"> <input type="submit" value="搜索"> </form> <br> <a class="page-back" href="{$host}">返回首页</a> </div> </div> </body> </html>
保存后在后台 [清空缓存并重新编译模板],然后访问前台页面看下404错误页面的效果吧!
友情提示:该页面没有任何图片,只是纯代码文字实现的404页面,如果对404页面没那么大需求的话可以直接复制以上代码拿去使用吧,需要其他的自行度娘查询!