How to enable Maintenance Mode – Magento

There's two ways, that I know of, to enable Maintenance Mode in Magento.


Since the version 1.4 you can activate the Maintenance Mode by just creating a file called maintenance.flag in your root directory.

Downside: it gets activated for everyone, including you with the admin sesion.

Don't panic! There's a workaround, here it is:

1. Open your index.php file in the root folder.

2. Look for this line (should be around the 57th line):

if (file_exists($maintenanceFile)) {
Code language: PHP (php)

3. Replace it with this one:

if (file_exists($maintenanceFile) && !in_array($ip, $allowed)) {
Code language: PHP (php)

4. Paste the following code above the line you just changed:

$ip = $_SERVER['REMOTE_ADDR']; $allowed = array('','');
Code language: PHP (php)

5. Change the IP with your own in the $allowed array you just pasted.

What more?

You can edit the 503 page by just going to: /errors/default/503.php


I wrote a post Magento Offline Maintenance Extension on 2010.

Check out the Maintenance Page - ArtsOn.IT extension.

About Ricard Torres

Senior Front-end Software Engineer from Barcelona, Haidong Gumdo Instructor (korean martial art of the sword), street photographer, travel lover, TV addict, Boston Red Sox fan, and privacy advocate.

@ricard_dev @ricard_dev

📝 Blog 🎙 Podcast

Leave a Reply

Add <code> Some Code </code> by using this tags.