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?


1 Answer 1


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('');

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.