Search code examples
php.htaccesscakephpmaintenance-mode

How to create a maintenance mode page in cakephp?


I am new to cakephp framework. what is the procedure to create a under construction or maintenance page in an existing site as am going to do some changes. am using cakephp 1.3. I googled it but it didnt get any step by step process.

I referred the Links below :

http://mark-story.com/posts/view/quick-and-dirty-down-for-maintenance-page-with-cakephp http://www.fedevel.com/welldoneblog/2011/01/cakephp-quick-and-simple-maintenance-page/

can anybody give me a solution .


Solution

  • Add the following code to your index.php file in public or webroot folder :

    define('MAINTENANCE', 0); if(MAINTENANCE > 0 && $_SERVER['REMOTE_ADDR'] !='188.YOUR.IP.HERE'){ require('maintenance.php'); die(); }

    In order to enable the mode you have to change the 0 to 1 in the first line of the code.

    Place your IP in the place 188.YOUR.IP.HERE from where you will make changes.

    Also add maintenance.php file in the same folder where the index.php that you have edited. maintenance.php file is the maintenance mode template file.