🇬🇧 How to customise the maintenance page in Laravel ?

September 23, 2024 · 1 min read · Fred B.

What is a maintenance page in Laravel?

Before starting, what is a maintenance page in Laravel ?

Maintenance mode allows you to send your visitors to a maintenance page while you update your application or perform maintenance on your server.

You can activate it with the following command in your favourite terminal:

php artisan down

And when you visit your app, you will see something like that :

Error 503

Not really fun, isn't it ?

<x-prezet::alert
    type="info"
    title="Secret tip of php artisan down"
    body="You can add one of the following options to keep an access to your site during the maintenance if you need if.
    --secret=[=SECRET] where you can define your own secret, or --with-secret which generate a secret for you."
/>

How can I customize my Laravel Maintenance Page?

It's very easy, and this is why this article is so short 🤣

Simply, add in your resources\views a folder errors if you already don't have.

Next, in this directory add a new file 503.blade.php.

Inside which, you could add something like that :

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Maintenance in progress</title>
    <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.0.2/dist/tailwind.min.css" rel="stylesheet">
</head>
<body class="flex items-center justify-center h-screen bg-gray-900">
    <div class="max-w-lg mx-auto mt-20 text-center">
        <h1 class="text-4xl font-bold text-gray-100 mb-6">Framework Heroes <br>is under maintenance</h1>
        <p class="text-lg text-gray-200 mb-4">We are updating the site.</p>
        <p class="text-lg text-gray-200 mb-4">Please come back later.</p>
        <img src="/images/maintenance.webp" alt="Maintenance" class="mx-auto w-96 mb-8">
        <p class="text-sm text-gray-300">Thank you for your patience!</p>
    </div>
</body>
</html>

And voilà !

The result

Of course, feel free to change this very basic template.

← All posts