What maintenance mode actually does
Maintenance mode takes your storefront offline in a controlled way. While it is on, ordinary visitors receive an HTTP 503 response with a maintenance page served from the pub/errors directory, and Magento stops processing storefront requests. Customers cannot browse, add to basket or check out, which is exactly what you want while the database schema is changing halfway through an upgrade. A half-migrated store that still takes orders is far worse than a store that is politely closed for twenty minutes.
The mechanism is refreshingly simple. Magento checks for a single file on every request: var/.maintenance.flag. If the file exists, the store is in maintenance mode. If it does not, the store is live. There is no database setting, no admin toggle and no hidden state. A second file, var/.maintenance.ip, holds the list of IP addresses that are allowed through while the flag is up. Everything the CLI commands below do comes down to creating, reading and deleting those two files.
Knowing that is worth more than it sounds. When a deployment tool dies mid-run and leaves your store showing the maintenance page at 2am, you do not need to remember a command: you need to know that deleting one file brings the store back.
The three commands you need
Everything runs from the Magento root directory on your server, as the user that owns the Magento files. To close the storefront:
bin/magento maintenance:enableTo reopen it when the work is finished:
bin/magento maintenance:disableAnd to check where you stand, which is worth doing before and after any maintenance window, especially one somebody else started:
bin/magento maintenance:statusThe status command reports whether maintenance mode is active and which IP addresses are currently on the allow list. If a colleague tells you "the site is down" during a planned window, thirty seconds with maintenance:status separates "working as intended" from a real incident.
Allow your own IP so you can still see the store
A maintenance window where nobody can check the site is a maintenance window flown blind. Magento lets you exempt specific IP addresses, so you and your developer see the real storefront while the public sees the 503 page. Pass the addresses when you enable maintenance mode:
bin/magento maintenance:enable --ip=1.2.3.4 --ip=5.6.7.8Or manage the list separately, before or during a window:
bin/magento maintenance:allow-ips 1.2.3.4The addresses are written to var/.maintenance.ip, one list for the whole installation. Add your office connection, your home connection and your agency's egress IP before a planned upgrade, then walk the store as a customer would while it is closed: home page, category page, product page, basket, checkout. Five minutes of clicking through on an allowed IP has caught many a broken deployment before the store reopened to the public.
One practical caveat: if your broadband provider rotates your IP address mid-window, you will suddenly see the maintenance page like everyone else. Nothing is broken. Look up your new public IP and run maintenance:allow-ips again with the fresh address included.
The flag file, and why stores get stuck
Because maintenance mode is just a file check, you can operate it without the CLI at all. Creating an empty file at var/.maintenance.flag closes the store; deleting it reopens the store. This is genuinely useful when CLI access is awkward: a deployment pipeline can touch and remove the flag as build steps, and if you only have SFTP or a file manager to hand, creating or deleting one file is all it takes.
touch var/.maintenance.flag # store closed
rm var/.maintenance.flag # store openThe same simplicity explains the most common maintenance mode problem: the store that stays stuck on the 503 page after an upgrade has finished. An interrupted setup:upgrade, a deploy script that crashed before its cleanup step, or a developer who simply forgot, and the flag file sits there keeping the shutters down indefinitely. The fix is the same every time: run bin/magento maintenance:disable, or delete var/.maintenance.flag by hand, and the store returns instantly. If it does not, the flag was never your problem, and the real error will be waiting in var/log/exception.log.
It is also worth knowing what maintenance mode does not do. It does not stop cron jobs, so indexing and email sending carry on in the background, and it does not block the CLI itself, which is the point: you take the storefront offline precisely so that setup:upgrade and friends can run against a quiet database.
The 503 page: customising it, and why the status code matters
The default maintenance page is functional and unbranded. It lives in pub/errors, outside your theme, because it has to work even when Magento itself cannot fully boot. To put your own branding on it, copy the default error skin inside pub/errors to a new folder, adjust the markup and stylesheet, then create a pub/errors/local.xml file that points the skin setting at your folder. From then on, planned windows show customers your logo and, ideally, one honest sentence: back within the hour. That single line converts an alarming dead end into a non-event.
Whatever the page looks like, the part search engines care about is invisible: the HTTP 503 status code. A 503 is the web's "temporarily unavailable" signal. Googlebot receives it, keeps your pages in the index, and schedules a retry. That is why a short maintenance window, an hour for an upgrade, even a morning for a big migration, does not cost you rankings that took years to build.
Two behaviours do cause damage. The first is staying in maintenance mode for a long time: after repeated 503 visits over a period of days, crawlers start treating the outage as permanent and pages begin dropping from the index. The second is the DIY holding page that returns 200 OK: to Google, that thin "we'll be back soon" page is now the live content of every URL it appears on, and it can replace your product pages in the index. Magento's built-in maintenance mode sends the correct 503 for you, which is a strong reason to use it instead of improvising at the web server level. If a window is going to run long, put a proper Retry-After value on the response and, more importantly, question why the work is not happening in staging.
When maintenance mode is the right tool
Maintenance mode is for moments when the live store's code and database are changing in ways that could break a customer mid-checkout. In practice that means four situations: Magento version upgrades, such as the move off 2.4.6 covered in our Magento 2.4.6 end of life guide; extension installs or removals on production when no staging environment exists; data and server migrations; and emergency incident response, where closing the store deliberately beats letting it fail publicly while you work.
What it is not for is routine development. The store that spends every Tuesday afternoon behind a 503 page is losing orders and testing Google's patience for no reason. The pattern that scales is to do the real work in a staging copy of the store, prove it there, and reserve maintenance mode on production for the short cutover moment when the tested change is applied. On EveryHost plans a staging environment is included exactly for this, and on managed Magento 2 hosting our engineers handle the maintenance windows themselves: we schedule them for your quiet hours, allow the right IPs, run the work and confirm the store is back before anyone notices. That workflow, staging first with short production windows, is standard on every specialist Magento 2 hosting UK plan we build, with the stack built to your store's required versions rather than a one-size install.
A note if you found this looking for Magento 1
Older guides describe a maintenance.flag file placed in the web root, with index.php edited by hand to let your own IP through. That was Magento 1, and it worked, but Magento 1 reached end of life in June 2020: no security patches, shrinking PCI defensibility, and an ecosystem that has moved on. If your store still runs on it, the productive next step is not a better maintenance page but a migration to a supported Magento 2 version. Everything above applies the day you arrive.
Frequently Asked Questions
Frequently Asked Questions
Sources and further reading
- Adobe Experience League, Enable or disable maintenance mode (Magento 2 installation guide)
- Adobe Experience League, Create the custom maintenance page (pub/errors and local.xml)
- Google Search Central, Pause or disable your online business: HTTP 503 best practice
- Adobe, Magento 1 end of support announcement (June 2020)
Want maintenance windows you never have to think about?
On EveryHost managed plans, our UK engineers schedule the window, run the upgrade in staging first, and reopen the store before your customers notice. Staging included, stack built to your store's required versions.