Home » Magento Guide » Magento Security Guide » How to enable maintenance mode in Magento 1: best practices

How to enable maintenance mode in Magento 1: best practices

Key takeaways

  • Magento 1 maintenance mode uses a maintenance.flag file in the Magento root directory.
  • Maintenance mode helps keep customers out of the store during updates, testing, or troubleshooting.
  • Trusted developer or admin IPs can be allowed through index.php while other visitors see the maintenance page.
  • Backups, staging, 503 handling, cache clearing, and rollback planning help reduce maintenance risk.

Magento 1 maintenance mode allows you to restrict customer access to your store while performing site maintenance. Unfortunately, it also freezes you out of the store. Add the following code to your index.php file to allow you to work on your site while everyone else sees Magento 1 maintenance mode displayed.

This guide explains how to enable maintenance mode in Magento 1, allow trusted access when needed, and reduce risk before, during, and after maintenance.

Host Magento at full throttle.

Get secure, reliable Magento hosting so you can scale faster.

What is Magento 1 maintenance mode?

Magento 1 maintenance mode temporarily restricts access to your storefront while you work on the site. It works by checking for a file named maintenance.flag in the Magento root directory.

When that file exists, Magento shows the maintenance response instead of the normal store. This helps prevent customers from browsing, placing orders, or seeing incomplete updates during extension changes, theme updates, server maintenance, database work, security fixes, or code deployments.

How to enable maintenance mode in Magento 1

To enable maintenance mode in Magento 1:

  1. Connect to your server with FTP, SFTP, or SSH.
  2. Navigate to the Magento root directory, near index.php.
  3. Create an empty file named exactly maintenance.flag.
  4. Place the file in the Magento root directory.
  5. Load the storefront to confirm the maintenance page appears.

The filename must be exact. If the file name is misspelled or placed in the wrong directory, maintenance mode may not work.

How to turn off Magento 1 maintenance mode

To disable maintenance mode:

  1. Connect to your server with FTP, SFTP, or SSH.
  2. Go to the Magento root directory.
  3. Delete the maintenance.flag file.
  4. Refresh the storefront and admin panel.

10 Magento 1 maintenance mode best practices

Enabling Magento 1 maintenance mode is only the first step. To avoid blocking the wrong users, hurting the customer experience, or creating problems after maintenance ends, follow these best practices before making changes on the live store.

These steps help you keep customers on the maintenance page while approved users can keep working, testing, and preparing the store to go live again.

1. Allow developer and admin IP access

Default Magento 1 maintenance mode can block everyone, including the developers or admins doing the work. To avoid that, you can allow trusted public IP addresses through index.php.

Open index.php. Above line 64, add the following and include the IPs to retain access to the site in the “allowed” array:

Replace the sample IP addresses with trusted public IPs.

Locate and change the line:

to

Save the file.

Then test the site from an allowed IP address and from a non-allowed connection. The allowed IP should reach the site, while public visitors should still see the maintenance page.

2. Account for Cloudflare or proxy IPs

If using Cloudflare, add the following code to your index.php file instead:

This helps Magento check the visitor’s original IP address instead of Cloudflare’s IP address.

Only use this approach when Cloudflare is trusted and configured correctly. If the site uses another proxy or CDN, confirm which header passes the real visitor IP before relying on IP allowlisting.

3. Keep the correct 503 response

Magento 1’s native maintenance mode uses a 503 Service Unavailable response through /errors/503.php. That status tells search engines the downtime is temporary.

Avoid replacing the maintenance response with a generic static page that returns 200 OK or a broken page that returns 404 Not Found. A proper 503 helps protect search visibility during planned maintenance.

4. Customize the Magento 1 maintenance page

The default Magento 1 maintenance page can look generic. A custom version gives customers a clearer message during planned downtime.

A safer approach is to copy the design from:

to a custom folder, such as:

Then rename:

to:

/errors/local.xml

Update the <report><template> value to your custom folder name. Then edit the 503.phtml file inside that custom folder.

A useful maintenance page should include a short message, an estimated return time if available, a support contact or help link, and simple brand styling.

5. Handle cache carefully

After you remove maintenance.flag, customers may still see a stale maintenance page if cache layers still serve it.

Clear Magento cache after maintenance. If your store uses server cache, CDN cache, Redis, Varnish, or another external cache layer, clear those too. Then test the storefront in a private browser window or from another device.

6. Schedule maintenance around customer activity

Schedule maintenance during lower-traffic windows when possible, especially if the work affects checkout, orders, customer sessions, or payment behavior.

For major database or schema changes, check active sessions when possible so you do not interrupt customers mid-transaction.

7. Use server-level rules for deeper infrastructure work

Magento’s maintenance.flag works inside Magento. But if you change PHP versions, web server configuration, or deeply integrated core files, Magento may fail before it can read the flag.

For those larger infrastructure changes, a server-level rule may provide better coverage. For Apache, a rule may look like this:

Test server-level rules carefully. A small mistake can block valid access or create redirect problems.

8. Run backups before maintenance

Before enabling maintenance mode, create a fresh backup of your Magento files and database. For larger updates, also confirm that media files, custom code, extensions, and configuration files have been backed up. Store important backups off-server when possible. 

9. Test changes in staging first

Test updates, code changes, extension changes, and database work in staging before touching the live store whenever possible.

Staging helps you catch errors before customers are affected and before the live site enters maintenance mode.

10. Prepare a rollback plan

A maintenance window should have a rollback plan before work begins. Know which files or database changes may need to be restored, where the backup is stored, who will handle rollback, and how you will confirm the store works afterward. This is especially important for checkout, payment, customer login, and order-related changes.

Magento 1 maintenance mode checklist

StageChecklist
Before maintenanceConfirm the maintenance window, back up files and database, test changes in staging, confirm FTP/SFTP/SSH access, back up index.php, prepare approved IP access if needed, and plan rollback steps.
During maintenanceAdd maintenance.flag, confirm the maintenance page appears, verify allowed IP access, keep the correct 503 response, and monitor errors or logs.
After maintenanceRemove maintenance.flag, remove temporary IP allowlists, clear Magento/server/CDN cache, test the homepage, product pages, cart, checkout, customer login, and confirm customers no longer see the maintenance page.

Magento 1 support note

Magento 1 is no longer the current Magento release line, but some stores still need to maintain Magento 1 environments. For those stores, maintenance mode should be used carefully with backups, staging, access controls, cache clearing, and reliable hosting support.

Magento 1 maintenance mode FAQs

Magento 1 maintenance mode can block the normal bootstrap process for the site, which may prevent both frontend and admin access unless trusted IPs are allowed.

Edit index.php to allow trusted public IP addresses while other visitors continue seeing the maintenance page.

Common causes include a forgotten maintenance.flag file, cache serving an old maintenance page, the file being placed in the wrong directory, or a server/CDN cache layer that needs to be cleared.

Getting started with Magento 1 maintenance mode

Magento 1 maintenance mode uses maintenance.flag to temporarily restrict storefront access, but a safer setup also accounts for trusted developer access, 503 behavior, cache, backups, and rollback planning.

Start by confirming your maintenance window, backing up the store, preparing approved IP access if needed, and testing your maintenance page before making production changes.

Magento 1 maintenance depends on reliable hosting, safe file access, backups, caching, and support. Explore Liquid Web Magento hosting for infrastructure built to help manage maintenance and troubleshooting with confidence.

For 24-hour assistance any day of the year, contact our support team by email or through your Client Portal.

Ready to get started?

Get the fastest, most secure Magento hosting on the market

Additional resources

How to clear a Magento cart with a url →

Clear a Magento cart with a url to simplify testing and troubleshooting.

Magento extensions vs plugins →

Compare extensions and plugins to understand how they add features to your store.

How to import Magento products →

Import products more efficiently with tips for organizing and uploading product data.