404页面设置的基本过程

2025-10-18 23:48:23

1、404页面代码

 404页面的要求是需要把文件名称设置为:404.HTML

其代码内容是:

 

<!doctype html><html><head><meta charset="utf-8"><title>404页面自动跳转</title><style>*{margin:0;padding:0;outline:none;font-family:\5FAE\8F6F\96C5\9ED1,宋体;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-khtml-user-select:none;user-select:none;cursor:default;font-weight:lighter;}.center{margin:0 auto;}.whole{width:100%;height:100%;line-height:100%;position:fixed;bottom:0;left:0;z-index:-1000;overflow:hidden;}.whole img{width:100%;height:100%;}.mask{width:100%;height:100%;position:absolute;top:0;left:0;background:#000;opacity:0.6;filter:alpha(opacity=60);}.b{width:100%;text-align:center;height:400px;position:absolute;top:50%;margin-top:-230px}.a{width:150px;height:50px;margin-top:30px}.a a{display:block;float:left;width:150px;height:50px;background:#fff;text-align:center;line-height:50px;font-size:18px;border-radius:25px;color:#333}.a a:hover{color:#000;box-shadow:#fff 0 0 20px}p{color:#fff;margin-top:40px;font-size:24px;}#num{margin:0 5px;font-weight:bold;}</style><script type="text/javascript"> var num=6;【这里设置你要等待的时间 数字越大时间越久 以秒为单位】function redirect(){  num--;  document.getElementById("num").innerHTML=num;  if(num<0){   document.getElementById("num").innerHTML=0;   location.href="http://你需要跳转的页面的网址";   }  } setInterval("redirect()", 1000);</script></head>

<body onLoad="redirect();"><div class="whole"> <img src="404页面背景图片位置”>    <div class="mask"></div></div><div class="b">  <img src=""404页面跳转显示图片ass="center"位于中间/>     暂时未能找到您查找的页面<br>   可能输入的网址错误或此页面不存在<br>            <span id="num"></span>秒后自动跳转到主页{文字可以修改根据自己意愿}   </div>

</body></html>

2、插入的图片是代码中需要添加的图片 可以根据自己的喜好添加

3、服务器控制面板

404页面设置的基本过程

404页面设置的基本过程

4、ftp文件上传

 在根目录下上传404.HTML,如果有图片需要新建文件夹,文件夹的名称与代码里面相同 把404背景放到图片文件夹里面然后调用

404页面设置的基本过程

5、最终显示

404页面设置的基本过程

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢