0

This question already has an answer here:

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.

marked as duplicate by Raphael at Digital Pianism, Fabian Schmengler, Qaisar Satti, Amit Bera, Adarsh Khatri Mar 24 '16 at 2:37

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

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

  • Should I add my system public IP over there? – Ramya Mar 23 '16 at 7:29
  • Yes. Or just search in google what is my IP?. – Rohit Kundale Mar 23 '16 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.