zbb20170301_好看的404和500页面

HTTP_404.jsp

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP ‘HTTP_404.jsp‘ starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet"
    href="${pageContext.request.contextPath }/static/css/bootstrap.min.css">
<script
    src="${pageContext.request.contextPath }/static/js/jquery-1.11.2.min.js"></script>
<script
    src="${pageContext.request.contextPath }/static/js/bootstrap.min.js"></script>
<link href="${pageContext.request.contextPath }/static/css/error.css" rel="stylesheet" type="text/css" />
</head>

<body class="page-404-full-page">

    <div class="row-fluid">

        <div class="span12 page-404">

            <div class="number">404</div>

            <div class="details">

                <h3>Opps, You‘re lost.</h3>

                <p>

                    We can not find the page you‘re looking for.<br />

                    <a href="./">Return home</a> 

                </p>

            </div>

        </div>

    </div>
  </body>

</html>

HTTP_500.jsp

<%@ page language="java" import="java.util.*" pageEncoding="utf8"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP ‘HTTP_500.jsp‘ starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet"
    href="${pageContext.request.contextPath }/static/css/bootstrap.min.css">
<script
    src="${pageContext.request.contextPath }/static/js/jquery-1.11.2.min.js"></script>
<script
    src="${pageContext.request.contextPath }/static/js/bootstrap.min.js"></script>
<link href="${pageContext.request.contextPath }/static/css/error.css" rel="stylesheet" type="text/css" />

</head>

<body>
<body class="page-500-full-page">

    <div class="row-fluid">

        <div class="span12 page-500">

            <div class=" number">500</div>

            <div class=" details">

                <h3>Opps, Something went wrong.</h3>

                <p>

                    We are fixing it!<br /> Please come back in a while.<br /> <a
                        href="./">Return home</a>

                </p>

            </div>

        </div>

    </div>
</body>
</html>

error.css

/***
Error Pages
***/

/* 404 page option #1 */

.page-404 {
  text-align: center;
}

.page-404 .number {
  display: inline-block;
  letter-spacing: -10px;
  margin-top: 0px;
  line-height: 128px;
  font-size: 158px;
  font-weight: 300;
  color: #7bbbd6;
  text-align: right;
}

.page-404 .details {
  margin-left: 40px;
  display: inline-block;
  padding-top: 0px;
  text-align: left;
}

/* 500 page option #1 */
.page-500 {
  text-align: center;
}

.page-500 .number {
  display: inline-block;
  letter-spacing: -10px;
  line-height: 128px;
  font-size: 158px;
  font-weight: 300;
  color: #ec8c8c;
  text-align: right;
}

.page-500 .details {
  margin-left: 40px;
  display: inline-block;
  text-align: left;
}

/* 404 page option #2*/
.page-404-full-page {
  padding: 20px;
  background-color: #fafafa !important;
}

.page-404-full-page .details input {
  background-color: #ffffff;
}

.page-404-full-page .page-404 {
  margin-top: 100px;
}

/* 500 page option #2*/
.page-500-full-page {
  padding: 20px;
  background-color: #fafafa !important;
}

.page-500-full-page .details input {
  background-color: #ffffff;
}

.page-500-full-page .page-500 {
  margin-top: 100px;
}

/* 404 page option #3*/

.page-404-3 {
  background: #000 !important ;
} 

.page-404-3 .page-inner img {
  right: 0;
  bottom: 0;
  z-index: -1;
  position: absolute;
}

.page-404-3 .error-404 {
  color: #fff;
  text-align: left;
  padding: 70px 20px 0;
}

.page-404-3 h1 {
  color: #fff;
  font-size: 130px;
  line-height: 160px;
}

.page-404-3 h2 {
  color: #fff;
  font-size: 30px;
  margin-bottom: 30px;
}

.page-404-3 p {
  color: #fff;
  font-size: 16px;
}

@media (max-width: 480px) { 

  .page-404 .number,
  .page-500 .number,
  .page-404 .details,
  .page-500 .details {
    text-align: center;
    margin-left: 0px;
  }

  .page-404-full-page .page-404 {
    margin-top: 30px;
  }

  .page-404-3 .error-404 {
    text-align: left;
    padding-top: 10px;
  }

  .page-404-3 .page-inner img {
    right: 0;
    bottom: 0;
    z-index: -1;
    position: fixed;
  }

}
时间: 2024-08-24 11:40:07

zbb20170301_好看的404和500页面的相关文章

django 配置404,500页面

Android Http 客户端编程之GET 说起Http编程,不尽然想起GET和POST两种请求方式,本文以简洁明了的的步骤和说明,将Android中常用的Http编程的方式列举出来,给刚刚在Android路上起步的奋斗者参考和指引,希望快速上手应用Android Http编程的同仁可以先绕过下面一段话. 做一件事之前,我们是否能驻足想一下要做这件事,我们需要做哪些工作,然后在经验中积累出模板思路和步骤,在程序界通常用设计模式来概括这些工作良好的解决方案.有了这些总结积累,这样我们就能举一反三

定制404、500页面

1. 首先将settings设置debug=false. 2. STATICFILES_DIRS = (    'static',    os.path.join(os.path.dirname(__file__),  '..', 'static'),    # Put strings here, like "/home/html/static" or "C:/www/django/static".    # Always use forward slashes,

自定义 404 与 500 错误页面,URL 地址不会重定向。

对于 404 与 500 错误发生时,我们希望自己定义一个更加人性化的页面. 例子 当访问下面这个地址时: http://localhost/aaaa/bbb/ccc/ddd/eee/fff/ggg 浏览器的 URL 不变,依然是 http://localhost/aaaa/bbb/ccc/ddd/eee/fff/ggg 但页面显示的是我们自定义的错误页面. 一.在 web.config 里增加以下节点. <system.webServer> <httpErrors errorMode=

nginx设置404 500页面跳转至首页,K哥

2015.9.29 开发找我说网站要设置个页面跳转 nginx设置404 500页面跳转至首页 什么是404页面? 如果碰巧网站出了问题,或者用户试图访问一个并不存在的页面时,此时服务器会返回代码为404的错误信息,此时对应页面就是404页面.404页面的默认内容和具体的服务器有关.如果后台用的是NGINX服务器,那么404页面的内容则为:404 Not Found 为什么要自定义404页面? 在访问时遇到上面这样的404错误页面,我想99%(未经调查,估计数据)的用户会把页面关掉,用户就这样悄

ASP.NET自定义404和500错误页面

在ASP.NET网站项目实际上线运行的过程中,有时候在运行环境下会出现400错误或者500错误,这些错误默认的页面都不友好,比较简单单调,其实我们可以自行设置这些错误所对应的页面,让这些错误跳转到我们指定的路径.此文将介绍如何在ASP.NET项目中设置404错误和500错误为例. 首先我们可以到网上下载到一些优美的404错误页面或者500错误页面的HTML模板,或者你也可以自行制作个HTML模板.然后将该页面放入到你的网站项目中,如果你的项目为WebForm项目,则你将需要新建一个Error.A

SpringBoot系列教程web篇之404、500异常页面配置

接着前面几篇web处理请求的博文,本文将说明,当出现异常的场景下,如404请求url不存在,,403无权,500服务器异常时,我们可以如何处理 原文友链: SpringBoot系列教程web篇之404.500异常页面配置 I. 环境搭建 首先得搭建一个web应用才有可能继续后续的测试,借助SpringBoot搭建一个web应用属于比较简单的活; 创建一个maven项目,pom文件如下 <parent> <groupId>org.springframework.boot</gr

iis php web.config处理404,500等,跳转友好页面,显示500错误信息

显示500错误信息 <pre name="code" class="html"><?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <httpErrors errorMode="DetailedLocalOnly" existingResponse="

ASP.NET网站中设置404自定义错误页面

在用ASP.NET WebForm开发一个网站时,需要自定义404错误页面. 做法是这样的 在网站根目录下建立了一个404.html的错误页面,然后在Global.asax文件中,加入如下代码: <%@ Application Language="C#" %> <script runat="server"> void Application_Error(object sender, EventArgs e) { Response.Status

HTTP返回代码代表的含义(403,404,500,502,504)

在网站日志中,我们经常会看到很多返回的http代码,如201.304.404.500等等.可是这些具体的返回的HTTP代码究竟什么含义呢,在此做一下知识普及吧,记不住不要紧,到时候看看就行了,但最主要的几个还要要清楚的. 一些常见的状态码为: 200 - 服务器成功返回网页 404 - 请求的网页不存在 503 - 服务器超时 1xx(临时响应) 表示临时响应并需要请求者继续执行操作的状态码. 100(继续)请求者应当继续提出请求.服务器返回此代码表示已收到请求的第一部分,正在等待其余部分. 1