1. Home
  2. Support
  3. Applications
  4. How to put Magento 1.x into maintenance mode

How to put Magento 1.x into maintenance mode

Putting Magento 1.x into maintenance mode can be done by placing a file named maintenance.flag in your domains root folder.

This can be done using FTP.

When a Magento site is put into maintenance mode even administrators will not be able to see the normal site or log in.

To gain access to the site while in maintenance mode the best thing to do is to allow your IP address.

The idea behind this is to change an if statement in index.php and add a condition for getting to the site from specific IP addresses.

First you will need to know your IP address.

The change you need to make is in index.php as follows:

$ip = $_SERVER['REMOTE_ADDR']; // This line fetches the visitors IP.
$allowedips = array('xxx.xxx.xxx.xxx','xxx.xxx.xxx.xxx'); // This is the IP address of whoever you want to be able to access the site / your IP address.

Once this is in place you will want to change an if statement from:

if (file_exists($maintenanceFile)) {

To:

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

This means the the maintenance page will only be shown if 1. the site is in maintenance mode, and 2. the IP address of the visitor is not in the $allowedips variable.

If either one of these conditions is false the site will not show the maintenance page.

Click here for full details

Classification: Public
Last saved: 2019/08/14 at 15:22 by Jamie