codingrow.com
Custom 404 & Maintenance

How to Customize the Magento 2 Maintenance Mode Page

A step-by-step native guide to enabling, whitelisting and branding the Magento 2 maintenance mode page during updates and deployments.

Custom 404 & Maintenance โ€” How to Customize the Magento 2 Maintenance Mode Page

Every Magento store owner eventually needs to take the site offline for an upgrade, a migration or a server change โ€” and by default, visitors land on a bare "Service Temporarily Unavailable" screen. This guide shows how to control and customize the Magento 2 maintenance mode page using native tools, so your downtime looks intentional instead of broken.

  • Enable and disable Magento maintenance mode safely via CLI
  • Whitelist your own IP so you can keep testing while customers see the maintenance page
  • Locate and edit the native maintenance page template to add your own message and branding
  • Know the limitations of the native approach and a faster alternative for non-developers

Step 1: Understand how Magento maintenance mode works

Magento's maintenance mode is triggered by a flag file at the root of your installation, not by an admin toggle.

  • When active, Magento creates a var/.maintenance.flag file.
  • Every request is intercepted and returns an HTTP 503 status.
  • Search engines understand 503 as "temporarily unavailable" and won't drop your rankings if the outage is short.
There is no Storesโ€บConfiguration setting for maintenance mode. It is fully CLI-driven, which is why many store owners never customize it.

Step 2: Enable maintenance mode via CLI

Connect to your server via SSH and run:

bin/magento maintenance:enable
all storefront and admin requests return the 503 page immediately, except whitelisted IPs.

To check the current status at any time:

bin/magento maintenance:status
Schedule maintenance during low-traffic hours and warn customers in advance via email or a banner the day before, especially for stores with recurring orders.

Step 3: Whitelist your IP address

You don't want to be locked out while testing your own update. Magento lets you allow specific IPs to browse normally during maintenance.

bin/magento maintenance:allow-ips 203.0.113.10

You can pass multiple IPs separated by commas. To enable maintenance mode and whitelist in one command:

bin/magento maintenance:enable --ip=203.0.113.10,203.0.113.11
search "what is my IP" in your browser before running the command.
If you forget to whitelist your own IP before enabling maintenance mode, you will see the same 503 page as your customers until you fix it from the server directly.

Step 4: Locate the native maintenance page template

Magento ships a default error page structure under:

pub/errors/default/

Key files inside this folder:

  • 503.phtml โ€” the HTML markup rendered during maintenance mode.
  • local.xml โ€” defines texts such as the page title and message.
  • default/css and default/images โ€” static assets used by the fallback page.
pub/errors/default :: this folder lives outside your theme, directly in the Magento file system.
These templates are plain PHP/HTML files, not Magento theme templates. Changes here are not managed by the admin panel and are not covered by standard Magento upgrades.

Step 5: Create a custom error page folder

To avoid overwriting core files (which get reset on upgrade), copy the default folder into a new one:

cp -r pub/errors/default pub/errors/local

Then point Magento to use it by editing:

pub/errors/local.xml
set to `local` so Magento serves your custom folder instead of `default`.

Step 6: Edit the maintenance message and branding

Open pub/errors/local/503.phtml in a code editor and update:

  • The page title and heading text.
  • The body message (e.g., "We're upgrading our store and will be back online shortly").
  • Add your logo by referencing an image placed in pub/errors/local/images/.
  • Adjust inline CSS or link to a custom stylesheet in pub/errors/local/css/.
replace "Service Temporarily Unavailable" with something like "We'll be back online at 14:00 (CET)".
Keep the message short and reassuring. Mentioning an estimated return time reduces support tickets and abandoned visits during the outage.

Step 7: Test before going live

Before relying on your custom page in production:

  • Open the storefront in an incognito window (not whitelisted) while maintenance mode is active.
  • Check the page on both desktop and mobile breakpoints.
  • Confirm the HTTP status code is still 503 using browser dev tools or a header-checking tool.
`503 Service Unavailable`, which is important for SEO continuity.

Step 8: Disable maintenance mode when finished

Once your update is complete:

bin/magento maintenance:disable
run `bin/magento maintenance:status` again to confirm it returns to normal operation.
Don't forget this step. A forgotten maintenance flag is one of the most common causes of "my store suddenly went down" support requests after a deployment.

Checklist

  • โ˜ Identify a low-traffic maintenance window
  • โ˜ Note your IP address and whitelist it before enabling maintenance mode
  • โ˜ Copy pub/errors/default to a custom folder to avoid losing changes on upgrade
  • โ˜ Update the message, title and logo in the custom 503.phtml
  • โ˜ Test the page from a non-whitelisted device\- [ ] Confirm the response is 503, not 200
  • โ˜ Disable maintenance mode and verify the store is back online

Document your maintenance procedure (commands, IPs, file paths) in a short internal runbook so any team member can repeat it safely.

Common mistakes

Problem: Editing files directly inside pub/errors/default instead of a custom folder.

Fix: Always duplicate the folder and point local.xml to it, so a future Magento update doesn't silently revert your branding.

Problem: Forgetting to whitelist your own IP, leading to confusion during testing.

Fix: Always run maintenance:allow-ips or pass --ip the moment you enable maintenance mode.

Problem: The maintenance page shows a generic style that doesn't match the brand, hurting trust during longer outages.

Fix: Add a logo, clear message and expected return time directly in the 503.phtml template.

Problem: Leaving maintenance mode enabled after deployment finishes.

Fix: Add bin/magento maintenance:disable as the final step of your deployment script, not a manual afterthought.

FAQ

Does maintenance mode affect my SEO rankings?

No, as long as the page correctly returns an HTTP 503 status code, search engines treat it as a temporary outage and won't deindex your pages for short maintenance windows.

Can I schedule maintenance mode automatically?

Native Magento does not include a scheduler; you need to trigger maintenance:enable and maintenance:disable manually or through your deployment pipeline (CI/CD, cron job, or server script).

Why can't I edit the maintenance page from the admin panel?

Maintenance mode templates live outside Magento's theme and configuration system, in the pub/errors folder, so there's no native admin UI for this โ€” it requires direct file editing.

Will customers see different maintenance pages per store view?

By default, no โ€” the same pub/errors template applies site-wide unless you build custom logic to detect store view and load different content.

A faster alternative

Editing pub/errors files, remembering to duplicate folders, and testing IP whitelisting works, but it takes developer time for something that happens several times a year. If you'd rather manage the branded page from the admin panel, upload a background image, adjust colors and preview changes live, the Custom 404 & Maintenance module adds this directly into Magento's configuration screen.

Standard Magento maintenance page showing the generic Service Temporarily Unavailable message
Standard Magento maintenance page showing the generic Service Temporarily Unavailable message

It generates a branded maintenance page with your title, message and a highlighted note (like an estimated return time), toggled the same way as native maintenance mode but with full visual control and no file editing required.

Branded maintenance page generated by the module, highlighting the estimated return time
Branded maintenance page generated by the module, highlighting the estimated return time
This kind of module is a convenience layer on top of Magento's native maintenance mode โ€” it doesn't replace the underlying bin/magento maintenance:enable mechanics described above, it simply makes the resulting page easier to brand and preview.

Questions & Answers

No questions yet โ€” be the first to ask.

Ask a question

Public. Shown only after moderation. No spam.

New guides, when they go live

One hands-on Magento 2 guide per email, only when we publish one. Nothing else.

Articles are written in English. One click to unsubscribe, in every email. ยท privacy