Display site maintenence message using Codeigniter

This example shows how we can show site maintenance message to the user. We build the website and live our website but it does not mean that all worked have been done for the website and in future we will never update or modify our site. So even after the website goes live we need to update the site continuously with new posts, news, products etc. Hence we need to halt the site so that end users cannot access the site for some time until or unless we are done with our updates. So when we modify or update on our site then it is not a good idea to allow end users access our site because it may cause problem at our end while updating as well as at end users end while they are accessing. It’s not also good idea halting the site without any appropriate message to the end users when we halt our site for few minutes or hours because they won’t know what’s happening to the site. So for this reason we need to show a friendly message to the end-users so that they can understand that the site is under maintenance and once the maintenance works are over then the site will be available again for access.

Our final output will be something like

site under construction using codeigniter

So I will use here hook. For more information on hooks please go through the Codeigniter Documentation http://ellislab.com/codeigniter/user-guide/general/hooks.html

First enable the hook in application/config/config.php file

Put a config variable in application/config/config.php file

Define the hook in application/config/hooks.php file

Now create the class file – site_offline.php and put it under application/hooks directory

 

That’s all. Thanks for your reading. Please do not forget to leave a comment.

Soumitra

Software Professional, I am passionate to work on web/enterprise application. For more information please go to about me. You can follow on Twitter. You can be a friend on Facebook or Google Plus or Linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.