Maintenance Mode differentiation visitor/admin


I implemented the Maintenance Mode following this thread, which works very well. Is there a way to differentiate as follows

not logged in / visitor -> Maintenance page
logged in / admin -> Full Webpage

So that I can test changes with the maintenance mode enabled?
Many thanks

Theres some help in here on redirecting based on login or not.

if($site->user()) go('/');

All you need is an additional check

if(!$site->user() and $site->maintenance()->isTrue() and $page->uid() != 'maintenance')):
1 Like

Works like a charme. May be a receipe for the cookbook.

No, I don’t think so. Maintenance mode is only useful for very limited use cases, because it requires a working Kirby installation. If that cannot be guaranteed, it is a better idea to use a separate html file.

Kirby will break and maintenance of no use, if parts of your site are missing.


I did that:, it could probably help you.


1 Like

@julieng I had a quick look, but in a standard Starterkit this plugin will always put the site offline, because the default is an invisible homepage?

Thank you for the tip!

I could add a field in the site setting to put the site invisible for public instead using the homepage visibility :slight_smile:

I add this to the road map.

Thanks for the hint, but I prefer to use static HTML / .htacess to take site offline. For me maintenance mode usually means up i’m deleting Kirby and uploading a fresh copy, so a plugin isn’t much good here because Kirby is missing.

1 Like

Yes, in that case, this plugin is not the right solution!