Maintenance Mode
Take the public site offline temporarily while admins continue working.
TL;DR
Admin → Settings → General: toggle Maintenance Mode on. Public visitors see a 503 maintenance page. Logged-in admins can still access everything normally. Toggle it off when ready.
Details
How It Works
When Maintenance Mode is enabled, the MaintenanceFilter intercepts every incoming request before it reaches a controller. Public visitors receive a 503 Service Unavailable HTTP response with the maintenance view (app/Views/maintenance.php).
The setting is stored as App.maintenanceMode via the CodeIgniter 4 Settings library and takes effect immediately — no server restart required.
Who Can Still Access the Site
The filter exempts the following routes, regardless of maintenance mode status:
admin/*— the entire admin panel remains accessible.login— so admins can log in if they are not already authenticated.logout— always available.register— kept accessible to avoid locking out new admin registrations.
Additionally, users who are already logged in as an admin pass through the filter and see the normal public site. This lets you preview the site while it is in maintenance mode.
The Maintenance Page
The default maintenance page (app/Views/maintenance.php) displays a simple message indicating the site is temporarily offline. You can customise this view directly to match your brand or add an estimated return time.
The response returns HTTP status code 503 (Service Unavailable). This tells search engines that the downtime is temporary and they should re-crawl later, rather than treating the pages as gone.
Enabling and Disabling
- Go to Admin → Settings → General.
- Find the Maintenance Mode toggle.
- Switch it On to activate, Off to deactivate.
- Save settings.
Use Cases
- Deploying major changes: enable maintenance mode, make changes, verify everything works (as admin), then disable.
- Manual database migrations: keep visitors out while you run migrations.
- Server maintenance: prevent new sessions and writes during infrastructure work.
- Initial setup: hide the site from the public while you configure content and settings.