0

I need to put frontend of my site to maintenance mode. so I enabled maintenance flag by creating empty folder in the name maintenance.flag in the root folder. But when I do this, my backend panel is also getting locked under maintenance mode. I want to work in my back panel So someone kindly guide me to enable maintenance mode only at frontend.

1

2 Answers 2

2

To do this, open the index.php in root and 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.

Next, search for this piece of code

if (file_exists($maintenanceFile)) {

and replace it with this:

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

Simple. Now you can access the site (admin + front end), while others see its maintenance mode.

Source: http://inchoo.net/ecommerce/magento/maintenance-mode-in-magento/

Hope this make sense to you

2
  • Should I add my system public IP over there?
    – Ramya
    Mar 23, 2016 at 7:29
  • Yes. Or just search in google what is my IP?. Mar 23, 2016 at 7:31
0

I found the solution, We have to add

$url=(!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];

before

$maintenanceFile = 'maintenance.flag';

in index.php

Not the answer you're looking for? Browse other questions tagged or ask your own question.