Laravel Maintenance Mode Custom Page Setup

Arman Rahman - Jun 19 '23 - - Dev Community

Sometimes we need to down our site for maintenance purposes. Luckily laravel gives the way to turn on maintenance mood with a command.

php artisan down
Enter fullscreen mode Exit fullscreen mode

we can bypass the website with a secret key.

php artisan down --secret="abc123xyz"
Enter fullscreen mode Exit fullscreen mode

and after that, we can access the site with the following URL.

https://yourdomain.com/abc123xyz
Enter fullscreen mode Exit fullscreen mode

You also can redirect the user to a specific error page while the Maintenance mood on.

php artisan down --redirect=/
Enter fullscreen mode Exit fullscreen mode

Custom Page Setup while Laravel Maintenance Mode on

  • First of all, you have to create a custom blade page on your view directory.
    example: maintenance.blade.php

  • After that run this on Terminal

php artisan down --render="maintenance"
Enter fullscreen mode Exit fullscreen mode
  • If your blade page is placed in a directory then use “::“ before the blade name. example:
php artisan down --render="directoryName::maintenance"
Enter fullscreen mode Exit fullscreen mode
. . . . . . . . . . . . . . . . . . . . . . . .