pbootcms设置404错误页面

2025-08-04 0 6

PbootCMS已经内置支持自定义内容地址错误情况下错误页面的自定义功能,只需要在站点根目录下定义404.html文件即可,效果如下图

pbootcms设置404错误页面分享给简单的404.html代码

<!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>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: ‘Segoe UI’, Tahoma, Geneva, Verdana, sans-serif;
}

body {
background-color: #f8f9fa;
color: #343a40;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
text-align: center;
padding: 20px;
background-image: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.container {
max-width: 600px;
padding: 40px;
background-color: white;
border-radius: 10px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
position: relative;
overflow: hidden;
}

h1 {
font-size: 120px;
color: #495057;
margin-bottom: 20px;
font-weight: 700;
line-height: 1;
}

h2 {
font-size: 28px;
margin-bottom: 15px;
color: #212529;
}

p {
font-size: 16px;
margin-bottom: 30px;
color: #6c757d;
line-height: 1.6;
}

.btn {
display: inline-block;
padding: 12px 30px;
background-color: #4e73df;
color: white;
text-decoration: none;
border-radius: 50px;
font-weight: 600;
transition: all 0.3s ease;
border: none;
cursor: pointer;
font-size: 16px;
}

.btn:hover {
background-color: #3a56b4;
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(78, 115, 223, 0.3);
}

.animation {
position: absolute;
width: 100px;
height: 100px;
background-color: rgba(78, 115, 223, 0.1);
border-radius: 50%;
top: -50px;
right: -50px;
animation: pulse 4s infinite;
}

.animation:nth-child(2) {
width: 150px;
height: 150px;
top: auto;
bottom: -75px;
left: -75px;
animation-delay: 1s;
}

@keyframes pulse {
0% {
transform: scale(0.8);
opacity: 0.7;
}
50% {
transform: scale(1.1);
opacity: 0.3;
}
100% {
transform: scale(0.8);
opacity: 0.7;
}
}

.search-box {
display: flex;
margin: 30px 0;
width: 100%;
max-width: 400px;
}

.search-input {
flex: 1;
padding: 12px 20px;
border: 1px solid #ddd;
border-radius: 50px 0 0 50px;
font-size: 16px;
outline: none;
}

.search-btn {
padding: 12px 20px;
background-color: #4e73df;
color: white;
border: none;
border-radius: 0 50px 50px 0;
cursor: pointer;
transition: background-color 0.3s;
}

.search-btn:hover {
background-color: #3a56b4;
}

@media (max-width: 600px) {
h1 {
font-size: 80px;
}

h2 {
font-size: 22px;
}

.container {
padding: 30px 20px;
}
}
</style>
</head>
<body>
<div class=”container”>
<div class=”animation”></div>
<div class=”animation”></div>
<h1>404</h1>
<h2>哎呀,页面走丢了!</h2>
<p>您访问的页面不存在或已被移除。可能是输入了错误的网址,或者页面已被移动到新的位置。</p>

<div class=”search-box”>
<input type=”text” class=”search-input” placeholder=”搜索网站内容…”>
<button class=”search-btn”>搜索</button>
</div>

<a href=”/” class=”btn”>返回首页</a>
</div>

<script>
// 简单的搜索功能
document.querySelector(‘.search-btn’).addEventListener(‘click’, function() {
const query = document.querySelector(‘.search-input’).value.trim();
if(query) {
alert(‘您搜索的内容是: ‘ + query + ‘\n(这是一个示例,实际使用时需要连接搜索功能)’);
// 实际使用时替换为:
// window.location.href = ‘/search?q=’ + encodeURIComponent(query);
}
});

// 回车键触发搜索
document.querySelector(‘.search-input’).addEventListener(‘keypress’, function(e) {
if(e.key === ‘Enter’) {
document.querySelector(‘.search-btn’).click();
}
});
</script>
</body>
</html>

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

版权声明:所有的源码、软件和资料,不得使用于非法商业用途,不得违反国家法律,一切关于该资源商业行为与本站无关。

免费cms模板 pbootcms教程 pbootcms设置404错误页面 https://www.mianfeicms.com/1336.html

相关文章

发表评论
暂无评论