Magento 1.x – Put Magento in maintenance mode and allow it for certain ips

This tutorial explains how to put your Magento online store in maintenance mode so your visitors know that you are working on your website.

To put a Magento site in maintenance mode, you need to create an empty maintenance.flag file and upload it to the root folder of your site.

After that your web site will look like this:


Note: Once you enable the maintenance mode, even if logged as admin, you won’t be able to access to the front end of the site.

If you want to allow certain ip addresses, you will need to change your index.php file in your root directory.

Look the following line

And change it with the following code:

After saving the file, you should be able to access the site with those ip addresses.