问题背景

  • 在 PbootCMS 中,需要设置一个自定义的 404 错误页面,以便在用户访问不存在的页面时显示友好的提示信息。

解决方法

  • 在网站根目录新建一个 404.html 文件,PbootCMS 会自动识别并使用该文件作为 404 错误页面。
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>404 - 页面未找到</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            text-align: center;
            margin: 0;
            padding: 50px;
        }
        h1 {
            color: #333;
        }
        p {
            color: #666;
        }
        a {
            color: #007BFF;
            text-decoration: none;
        }
        a:hover {
            text-decoration: underline;
        }
    </style>
</head>
<body>
    <h1>404 - 页面未找到</h1>
    <p>您访问的页面不存在。</p>
    <p><a href="/">返回首页</a></p>
</body>
</html>