404页面,具体怎么设置 1金币 .anslist{background:url(source/plugin/keke_answer/template/images/coin.png) left center no-repeat;font-family:Microsoft Yahei; padding:2px 0px 2px 20px; margin:0px 0px 0px 10px; font-size:12px; color:#F30; text-decoration:none} .anslist b
DZ3.5安装了亮剑的套餐,有些情况下需要404页面,具体该怎么设置,(试过网上的多种方式都不行,如下行所示)哪位老板具体介绍下404.HTML究竟怎么配置1.首页新建一个文本文件命名为 404.php,然后用文本编辑器打开,填入以下代码,并保存;
复制代码
将$navtitle = "404提示"这行代码中的“404提示”修改为你的404页面的标题,保存之后将404.php上传到你网站的根目录,
2.接下来用编辑器打开你的404的html文件(后缀为.html或者.htm),去掉head,body标签,只留下与中间的那段代码,其他全去掉
然后在最上面一行加上{template common/header},在最下面一行加上{template common/footer},保存
3.然后上传到你的服务器上的template\default\common目录里,如果你不是用的默认模板,记得将default改成你模板目录名,
4.最后,apache修改服务器配置文件上的404页面声明,也就是把 ErrorDocument 404 /404.html改成ErrorDocument 404 /404.php,不同服务器修改教程大家自行去网上找,然后你就访问一个你网站没有的路径,比如在你的域名后随便打几个字母,如http://bbs.itqu.net/errorpage就可以看到效果
最后再用HTTP返回码查询工具检测一下HTTP状态,这里成功检测出状态码为404
--------------------------------------------- 华丽分割线---------------------------------------------------
如果是nginx,在配置文件里可以看到
#ERROR-PAGE-START错误页配置,可以注释、删除或修改 error_page 404 /404.html; error_page 502 /502.html;#ERROR-PAGE-END
复制代码
就直接在根目录放一个404.html
很抱歉,网页不存在!body {margin: 0px; padding:0px; font-family:"微软雅黑", Arial, "Trebuchet MS", Verdana, Georgia,Baskerville,Palatino,Times; font-size:16px;}div{margin-left:auto; margin-right:auto;}a {text-decoration: none; color: #1064A0;}a:hover {color: #0078D2;}img { border:none; }h1,h2,h3,h4 {/*display:block;*/ margin:0; font-weight:normal; font-family: "微软雅黑", Arial, "Trebuchet MS", Helvetica, Verdana ;}h1{font-size:44px; color:#0188DE; padding:20px 0px 10px 0px;}h2{color:#0188DE; font-size:16px; padding:10px 0px 40px 0px;}#page{width:910px; padding:20px 20px 40px 20px; margin-top:80px;}.button{width:180px; height:28px; margin-left:0px; margin-top:10px; background:#009CFF; border-bottom:4px solid #0188DE; text-align:center;}.button a{width:180px; height:28px; display:block; font-size:14px; color:#fff; }.button a:hover{ background:#5BBFFF;} 网页不存在,即将跳转新网址 The website is moving. It is about to jump to the new website. 若网页未能自动跳转新网址,请点击下面按钮进行跳转! 进入新网址
复制代码
上面代码可以在访问不到的时候自动跳转首页!
我知道答案 回答被采纳将会获得1 贡献 + 1 金币 已有1人回答 谢谢分享,受教了
页:
[1]