全站跳转404页面的示例

复制代码
全站跳转404页面的示例

# 20200520 全站跳转404页面
if ($request_uri !~* "/404.html") {
    rewrite ^/(.*)$ /404.html permanent;
}


404页面源码:404.html 

<!DOCTYPE html>
<html>
<style>
body {
  background-color: #ECECEC;
  font-family: 'Open Sans', sans-serif;
  font-size: 14px;
  color: #3c3c3c;
}
 
.demo p:first-child {
  text-align: center;
  font-family: cursive;
  font-size: 150px;
  font-weight: bold;
  line-height: 100px;
  letter-spacing: 5px;
  color: #fff;
}
 
.demo p:first-child span {
  cursor: pointer;
  text-shadow: 0px 0px 2px #686868,
    0px 1px 1px #ddd,
    0px 2px 1px #d6d6d6,
    0px 3px 1px #ccc,
    0px 4px 1px #c5c5c5,
    0px 5px 1px #c1c1c1,
    0px 6px 1px #bbb,
    0px 7px 1px #777,
    0px 8px 3px rgba(100, 100, 100, 0.4),
    0px 9px 5px rgba(100, 100, 100, 0.1),
    0px 10px 7px rgba(100, 100, 100, 0.15),
    0px 11px 9px rgba(100, 100, 100, 0.2),
    0px 12px 11px rgba(100, 100, 100, 0.25),
    0px 13px 15px rgba(100, 100, 100, 0.3);
  -webkit-transition: all .1s linear;
  transition: all .1s linear;
}
 
.demo p:first-child span:hover {
  text-shadow: 0px 0px 2px #686868,
    0px 1px 1px #fff,
    0px 2px 1px #fff,
    0px 3px 1px #fff,
    0px 4px 1px #fff,
    0px 5px 1px #fff,
    0px 6px 1px #fff,
    0px 7px 1px #777,
    0px 8px 3px #fff,
    0px 9px 5px #fff,
    0px 10px 7px #fff,
    0px 11px 9px #fff,
    0px 12px 11px #fff,
    0px 13px 15px #fff;
  -webkit-transition: all .1s linear;
  transition: all .1s linear;
}
 
.demo p:not(:first-child) {
  text-align: center;
  color: #666;
  font-family: cursive;
  font-size: 20px;
  text-shadow: 0 1px 0 #fff;
  letter-spacing: 1px;
  line-height: 2em;
  margin-top: -50px;
}
</style>
<head>
<meta charset=utf-8 />
<title>404Ӵ</title>
</head>
<body>
  <div class="demo">
    <p><span>4</span><span>0</span><span>4</span></p>
    <p>page not found</p>
  </div>
</body>
</html>
复制代码

 

来个404页面的又一个示例

复制代码
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0,user-scalable=no">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <title>Under maintenance</title>
    <style type="text/css" media="all" rel="stylesheet">
        body{background: #5B5D8E;color: #D5D6E2;    font-family: "Segoe UI", "Lucida Grande", Helvetica, Arial,sans-serif;}
        a {
            color: #333333;
            cursor: pointer;
            text-decoration: none;
        }
        a:hover, a:focus {
            color: #2F2F2F;
            text-decoration: none;
        }
        a:focus {
            outline: none;
        }
        .error {
            width: 100%;
            max-width: 1440px;
            margin: 0 auto;
            text-align: center;
        }
        .error-block {
            padding-top: 80px;
            padding-bottom: 20px;
        }
        h3 {
            margin: 40px 0 20px 0;
            font-weight: bold;
        }
        .sub-title {
            margin: 10px 0 30px 0;
            font-size: 14px;
        }
        .sub-title a {
            color: #3194D0;
        }
        .res-warp img {
            margin-right: 15px;
            width: 80px;
            height: 80px;
            vertical-align: middle;
        }
        .res-warp .app, .res-warp .weibo {
            width: auto;
            height: 60px;
        }
        .info p {
            font-size: 12px;
            color: #9B9B9B;
        }
        @media (max-width: 768px) {
            .error-page-logo, .error-footer {
                display: none;
            }
        }
        .attention{
            font-size: 186px;
        }
    </style>
</head>
<body lang="zh-CN" class="reader-black-font">
<div class="error">
    <div class="error-block">
        <div class="attention">404</div>
        <div class="sub-title">Sorry, our website is not found. Please <a href="index.html">click here</a> to index </div>
    </div>

</div>


</body>
</html>
复制代码

 

 

多语言适配404页面

location /fr {
    error_page 404 403 /fr/404.html;
}


location /es {
    error_page 404 403 /es/404.html;
}
location /it {
    error_page 404 403 /it/404.html;
}
location /de {
    error_page 404 403 /de/404.html;
}
location /pt-br {
    error_page 404 403 /pt-br/404.html;
}

error_page  404 403             /404.html;

posted @   reblue520  阅读(1021)  评论(0编辑  收藏  举报
编辑推荐:
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
点击右上角即可分享
微信分享提示