Discuz设置404页面教程-实用
本帖最后由 Jimoy 于 2021-7-14 00:17 编辑1.首页新建一个文本文件命名为 404.php,然后用文本编辑器打开,填入以下代码,并保存;<?php
define('CURSCRIPT', '404');
require './source/class/class_core.php';
C::app()->init();
$navtitle = "404提示"; // 这里修改404页面标题
include template('common/404'); // 这里是你的404页面模版
?>将$navtitle = "404提示"这行代码中的“404提示”修改为你的404页面的标题,保存之后将404.php上传到你网站的根目录,
2.接下来用编辑器打开你的404的html文件(后缀为.html或者.htm),去掉head,body标签,只留下<body>与</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<!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>很抱歉,网页不存在!</title>
<style type="text/css">
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;}
</style>
</head>
<body>
<div id="page" style="border-style:dashed;border-color:#e4e4e4;line-height:30px;background:url(sorry.png) no-repeat right;">
<h1>网页不存在,即将跳转新网址</h1>
<h2>The website is moving. It is about to jump to the new website. </h2>
<meta http-equiv="refresh" content="1;url=http://bbs.itqu.net">
<font color="#666666">若网页未能自动跳转新网址,请点击下面按钮进行跳转!</font><br /><br />
<div class="button">
<a href="http://bbs.itqu.net" title="进入新网址">进入新网址</a>
</div>
</div>
</body>
</html>上面代码可以在访问不到的时候自动跳转首页!
Best Website for Software Downloads
Hi everyone,I'm looking for some advice on the best website for downloading software. I want a site that’s reliable, safe, and offers a wide range of software options.
Here’s what I’m looking for:
Reliability: Trusted by users and consistently provides safe downloads.
Wide Range of Software: Offers a variety of software, from utilities to productivity tools.
User-Friendly Interface: Easy to navigate and find what I need.
Regular Updates: Ensures the latest versions of software are available.
Good Customer Reviews: Positive feedback from other users.
If you have any recommendations or know of any great sites, please share! Your suggestions would be greatly appreciated.
Thanks!
页:
[1]