1

This question already has an answer here:

Is there a way to place the front end of Magento into maintenance mode so that customers cannot access anything BUT the admins are still able to access the back end and place orders against products?

marked as duplicate by Raphael at Digital Pianism, Fabian Schmengler, Qaisar Satti, Anna Völkl, Rajeev K Tomy Jun 2 '16 at 7:47

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.

3

To put your site under maintenance you need to create a maintenance.flag file under root directory.

This will make your site under maintenance mode due to which you are also not able to access the site. To make site accessible to you, you need to follow the following steps.

Open index.php which is located at root directory and add the below code above if (file_exists($maintenanceFile)) {.

The code needs to be added is

// To get IP of accessing machine
$machineIp = $_SERVER['REMOTE_ADDR'];

// Your IP
$myIp = array('192.168.2.4');

and then change if (file_exists($maintenanceFile)) { this code to if (file_exists($maintenanceFile) && !in_array($machineIp, $myIp)) {

and you are done. now you can access both admin and front end of your site.

Hope this will help you.

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