How to put magento in maintenance

To enable maintenance mode in Magento, just create empty maintenance.flag file in the root of your Magento store.


Just add a blank file called maintenance.flag to your root.. job done

A neater solution is to use this extension.

it allow you to set the store up so that once logged into the back end you have access to the front + a few other neat features


I use this often. http://inchoo.net/ecommerce/magento/maintenance-mode-in-magento/

The important part is:

Open: index.php in root and above line 57 add (remembering to edit the ‘allowed’ array to contain the IP’s you want to be able to access the site);

$ip = $_SERVER['REMOTE_ADDR'];
$allowed = array('1.1.1.1','2.2.2.2'); // these are the IP's that are allowed to view the site.

then change the line

if (file_exists($maintenanceFile)) {

to

if (file_exists($maintenanceFile) && !in_array($ip, $allowed)) {

Thats what I add to the index in order to be able to continue working from different IPs:

//EGS to show a maintenance page but be able to work
$ip = $_SERVER['REMOTE_ADDR'];

// these are the IP's that are  allowed to view the site:
$allowed = array('111.111.111.111', '222.222.222.222');

if (file_exists($maintenanceFile) && !in_array($ip, $allowed)) { 
    include_once dirname(__FILE__) . '/errors/503.php';
    exit;
}