Magento: How to enable maintenance mode?

Maintenance mode is a key feature required to any website. You need to set the live website into maintenance mode whenever you need to do any changes in the website. Here, I will show how you can do this in Magento.

For Magento version 1.4 and above,
you just need to create a file named maintenance.flag in your Magento root. Then, your website automatically goes into maintenance mode. To make the site live again, you can just delete the newly created maintenance.flag file.

You can edit maintenance mode template file. It is present in errors/default/503.phtml

For Magento version 1.3 and below,
– create a file called index.html in Magento root and write your maintenance messege in it
– write the following code in the beginning of index.php


<?php
// replace with your development IP
if ($_SERVER['REMOTE_ADDR']!=='1.2.3.4') { 
  header("Location: /index.html");
  exit;
}

Hope this helps. Thanks.