DEV Community

Cover image for How to do maintenance on a live website (Laravel 8)
Khwaja Billal Siddiqi
Khwaja Billal Siddiqi

Posted on

How to do maintenance on a live website (Laravel 8)

Maintenance injects fresh blood into the application.

After deploying your application to production it needs to be maintained. So Laravel makes it easy for you.
To active maintenance mode, you just need to run this command

php artisan down
Enter fullscreen mode Exit fullscreen mode

This will disable your application and show a 503 error page for the user.

By adding a secret key while you enable maintenance mode you can access the application even it’s in maintenance mode

php artisan down --secret="123456789"
Enter fullscreen mode Exit fullscreen mode
https://yourDomain.com/123456789 
Enter fullscreen mode Exit fullscreen mode

What if you want to redirect all requests to a specific route? for doing that just add the flag of redirect while you enable maintenance mode.

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

And finally after completing the maintenance run this command to disable maintenance mode & let the user enjoy using your application.

php artisan up
Enter fullscreen mode Exit fullscreen mode

For digging deeper visit: Laravel Maintenance Mode

Top comments (1)

Collapse
 
jovialcore profile image
Chidiebere Chukwudi

Awesome !!!!