如果你希望在访问PbootCMS网站时,对于死链提示“您访问的页面不存在”能够自动跳转到另一个页面,可以通过修改error.html文件来实现这一功能。

具体步骤

  1. 打开error.html文件

    • 打开根目录下的core/template/error.html文件。
  2. 修改HTML内容

    • error.html文件的内容修改为以下内容:
    <!doctype html>
    <html>
    <head>
        <meta charset="utf-8">
        <title>错误信息</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0" />
        <meta name="Apple-mobile-web-app-capable" content="yes" />
    </head>
    <body>
    
    <div style="margin-left:10%;margin-top:5%;">
        <div style="margin-bottom:20px;"><img src="{coredir}/template/face02.png" height="120"></div>
        <div style="font-size:20px;margin-bottom:20px;">{info} <span id="time" style="font-size:18px;"></span></div>
        <div style="margin-bottom: 1rem;">
            <p>页面将在1秒后自动跳转到另一个页面...</p>
            <script>
                setTimeout(function() {
                    window.location.href = 'http://www.baidu.com/'; // 替换为你想要跳转的URL
                }, 1000); // 1000毫秒后执行
            </script>
        </div>
        <div><span style="font-size:12px;border-top:1px solid #ccc;color:#ccc;padding-top:2px;">
            程序版本:{appversion}
        </span></div>
    </div>
    
    {js}
    
    </body>
    </html>

说明

  1. 标题和元信息

    • 确保保留了必要的<title><meta>标签,以保持页面的基本结构。
  2. 错误信息

    • {info} 是动态插入的错误信息,保留此占位符。
  3. 图片路径

    • {coredir}/template/face02.png 是错误页面使用的图片路径,确保路径正确。