How to enable Maintenance Mode – Magento

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

Maintenance.flag

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)) {

3. Replace it with this one:

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

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

$ip = $_SERVER['REMOTE_ADDR'];

$allowed = array('0.0.0.0','1.1.1.1');

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

Extension

I wrote a post Magento Offline Maintenance Extension on 2010.

Check out the Maintenance Page – ArtsOn.IT extension.

No comments yet, leave yours!

Leave a Reply

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