Excluding the Control Panel from Maintenance Mode

Laravel's maintenance mode is a great way to notify visitors that your site is down but will be back up shortly. But what if you still want to get into the control panel? Here's how.

Overview

When your site is in Laravel's maintenance mode, a custom view will be displayed for all requests into your site. This makes it easy to "disable" your site while it is updating or when you are performing maintenance. The logic for this mode is handled in the default middleware.

To enable maintenance mode, run the down Artisan command:

php artisan down

And to disable maintenance mode, run the reverse up Artisan command:

php artisan up

Excluding URLs

URLs that should remain "up" while in maintenance mode can be defined in your app/Http/Middleware/PreventRequestsDuringMaintenance.php file. Assuming your control panel uses the default /cp URL, use the following config to exclude it:

// app/Http/Middleware/PreventRequestsDuringMaintenance.php
 
protected $except = [
'/cp',
'/cp/*'
];
Docs feedback

Submit improvements, related content, or suggestions through Github.

Betterify this page →
Hello there! Are you looking for the Statamic v2 documentation?