Magento Maintenance Mode – how and when to use

What is Magento Maintenance mode

Sometimes you need to keep your online store not available for visitor, for example when you do major updates like apply new design/theme and don’t want your customers to see something weird on your website. Magento has built-in feature to handle this situation, so it is quite simple to organize. So no need to play with htaccess, create a temp index file and think about what happens if a customer visits deep link to internal page.

Click here to find out how Magenable can provide you with high quality Magento support and maintenance service

How to set Magento in maintenance mode

To set Magento in maintenance mode you need to create a file with name “maintenance.flag” and drop it to Magento home directory. While this file exists your website visitors will see a temporary page (/errors/503.php). If you want to edit this page content you can find it in Magento admin – CMS/Pages, it is called “503 Service Unavailable”.

Once you finished with changes and your website is ready to work just delete maintenance.flag file and maintenance mode will be off, so your Magento website will work as usual.

Note that before you disable maintenance mode you can’t access Magento admin either, but don’t panic if it isn’t what you want, check the next section.

Can me and my team see the Magento website while it is in maintenance mode?

Wouldn’t it be good to give your team an ability to see your website while it is in maintenance mode?  Fortunately there is a way to organize it with a little tweak of index.php file in your home directory.

Add the next code:


$allowed = array(‘′,’’); // allowed IPs – list there IP addresses of your offices/employees


Next find a line:

if (file_exists($maintenanceFile)) {

and change it to:

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

After that change your team (with IP addresses listed as allowed IPs can access the website, while other visitors will see 503 Service Unavailable page.


While we try our best to prepare accurate recommendations, it isn’t guaranteed that they will work flawlessly in your particular Magento install, so make all pre-cautions before trying it and share your experience with others in the comments to this post.


  1. Inchoo blog “A better maintenance mode for Magento
  2. Stack Exchange

Do you need Magento maintenance and support service for your online store?

We provide one from $995 (plus GST) per month, check Support and Maintenance page for details.

Get fresh eCommerce insights weekly

Subscribe to our mailing list

* indicates required

No, I don't need insights. Just close this pop-up

Consider changing your eCommerce platform?

Learn how to avoid nine deadly mistakes that can ruin your business.

Get free whitepaper from Magenable

Get whitepaper

Get free whitepaper!