Contact
Site: US UK AU |

How to improve Magento maintenance mode

How to improve Magento maintenance mode

Overview
This article outlines how to improve Magento maintenance mode by modifying to the index.php file to allow access to a range of IP addresses.  

Rationale

Magento's maintenance mode allows you to restrict customer access to your store while performing site maintenance.  Unfortunately, it also freezes you out of the store.  Add the following code to your index.php file to allow you to work on your site while everyone else sees maintenance mode.

Procedure

  1. Open index.php. Above line 64, add the following and include the IPs to retain access to the site in the "allowed" array:

    $ip = $_SERVER['REMOTE_ADDR'];

    $allowed = array('1.1.1.1','2.2.2.2');

  2. Locate and change the line:

    if (file_exists($maintenanceFile)) {

    to

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

  3. Save the file. 

Cloudflare procedure

If using Cloudflare, add the following code to you index.php file instead:

$ip = $_SERVER['HTTP_CF_CONNECTING_IP'];

$allowed = array('1.1.1.1','2.2.2.2');

 

For 24-hour assistance any day of the year, contact our Support Team by email or through the Client Portal.

Article Rating (No Votes)
Rate this article
  • Icon PDFExport to PDF
  • Icon MS-WordExport to MS Word
 
Attachments Attachments
There are no attachments for this article.
Related Articles RSS Feed
What are some useful Magento scripts?
Added on Mon, Oct 13, 2014
How to protect your Magento store from the Credit Card Hijack exploit
Added on Tue, Nov 22, 2016
How to change your Magento 1.x password
Added on Wed, Nov 30, 2016
How to configure multiple Magento storefronts
Added on Mon, Jul 29, 2013
How to configure Magento to use your SSL certificate
Added on Mon, Feb 29, 2016
How to configure CDN access for Magento
Added on Wed, May 16, 2018
How to add admin users in Magento 1.x
Added on Wed, Dec 7, 2016
How to remove index.php from your Magento site URL
Added on Wed, May 31, 2017
How to install Magento CE v1.8 and later
Added on Thu, Mar 6, 2014
How to patch your Magento 1 store
Added on Thu, Oct 18, 2018