create maintenance page


how can i create a maintenance page?

i want to global check a application-level parameter (e.g. Yii::app()->params[‘maintenance’] == true) and if this is true it should always display the maintenance page whatever page is requested.

where to put the code for the check? sitecontroller?



tested this (

created the view and put this into my config/main.php

'catchAllRequest' => Yii::app()->params['maintenance'] ? array('site/maintenance') : null,

but dont work for me. any ideas?

This use to be a problem when people want to use basePath from within the config array (before it’s defined, that is).

I posted a possible solution here.

In your case

'catchAllRequest' => $preConfig['params']['maintenance'] ? array('site/maintenance') : null,


also a rule like


would work