Laravel5で404エラーページを表示させたい。 apacheの標準ではURLが存在しなかった場合not foundを表示させている。

Not Found
The requested URL /hoge was not found on this server.
Apache/2.2.15 (CentOS) Server at ドメイン名 Port 80

このようではなく、カスタムページを表示させたいという内容。

resorce/views/errors/の中に404.blade.phpというファイルを作る

resource/views/errors/404.blade.php ファイルの中身(同ディレクトリにある503.blade.phpの内容を変えたものです。)

<!DOCTYPE html>
<html>
    <head>
        <title>エラー</title>

        <link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css">

        <style>
            html, body {
                height: 100%;
            }

            body {
                margin: 0;
                padding: 0;
                width: 100%;
                color: #B0BEC5;
                display: table;
                font-weight: 100;
                font-family: 'Lato';
            }

            .container {
                text-align: center;
                display: table-cell;
                vertical-align: middle;
            }

            .content {
                text-align: center;
                display: inline-block;
            }

            .title {
                font-size: 72px;
                margin-bottom: 40px;
            }
        </style>
    </head>
    <body>
        <div class="container">
            <div class="content">
                <div class="title">許可さていないアクションです。または違いますよ!</div>
            </div>
        </div>
    </body>
</html> 



最終更新:2016年06月14日 19:40