◦ Comprehensive security
◦ 24/7 support
Magento Guide → Security → Maintenance Mode
Magento 2 maintenance mode: how to enable/disable
There are times when you need to take your Magento store offline—like during an upgrade, extension install, or bug fix. You want customers to know it’s just temporary, and you need to avoid disruptions while you work. That’s where Magento 2’s maintenance mode comes in.
Let’s walk through exactly what it does, when to use it, and how to turn it on and off safely.
Host Magento at full throttle.
Get secure, reliable Magento hosting so you can scale faster.
What is maintenance mode in Magento 2?
Maintenance mode is a built-in Magento 2 feature that temporarily takes the storefront offline. Visitors who try to access your site will see a “Service Temporarily Unavailable” message, and Magento will send a 503 HTTP status to search engines to indicate that downtime is temporary.
Meanwhile, your team can still access the backend, if you whitelist your IP address. This makes it ideal for safe updates, configuration changes, or troubleshooting without exposing errors or broken pages to customers.
When to use Magento 2 maintenance mode
Maintenance mode is most helpful in situations where changes could break the storefront or create a bad user experience. Common examples include:
- Installing or updating extensions: Adding new functionality could trigger compatibility issues until everything is configured.
- Running Magento upgrades or security patches: Version changes can cause downtime or display errors.
- Switching or modifying themes: Design updates may look broken or inconsistent until deployment is complete.
- Fixing critical bugs: If a module is misbehaving or the site is throwing errors, put it in maintenance mode first.
- Running custom scripts or database updates: Some CLI or SQL changes could crash pages while they run.
If your store is in production mode and actively serving customers, it’s best to activate maintenance mode before making backend changes.
How to enable maintenance mode in Magento 2
Magento gives you two ways to enable maintenance mode: through the command line (recommended) or by manually creating a file.
Use the Magento CLI
The easiest and most reliable way is using the bin/magento command. Here’s how:
- Connect to your server via SSH.
- Navigate to the root directory of your Magento 2 installation.
- Run this command:
bin/magento maintenance:enable
This instantly puts the site into maintenance mode. Magento will create a .maintenance.flag file in the var directory to control this state.
Whitelist your IP address
If you need to keep working on the frontend (for example, to test pages after an update), you can allow specific IPs to bypass maintenance mode.
To enable maintenance mode and allow your own IP through:
bin/magento maintenance:enable –ip=123.123.123.123
Replace 123.123.123.123 with your real IP address.
Add more IPs by repeating the –ip flag:
bin/magento maintenance:enable –ip=123.123.123.123 –ip=124.124.124.124
You can check your current public IP address using whatismyip.com or the command line with:
curl ifconfig.me
Enable via filesystem (manual method)
If you don’t have access to Magento’s CLI—or want to enable maintenance mode using a file-based method:
- Connect to your server using SSH or FTP.
- Navigate to the root of your Magento 2 installation.
- Create the file:
touch var/.maintenance.flag
This has the same effect as running the CLI command. The presence of .maintenance.flag tells Magento to show the 503 error page.
How to disable maintenance mode in Magento 2
When you’re ready to go live again, you can disable maintenance mode by removing the flag file.
Use the Magento CLI
This is the fastest method:
From your Magento root directory, run:
bin/magento maintenance:disable
This removes the .maintenance.flag file and restores normal access to the storefront.
Disable manually via filesystem
If you enabled maintenance mode by creating the file manually, you can disable it the same way:
- Navigate to your Magento root directory.
- Run this command:
rm var/.maintenance.flag
Make sure you don’t accidentally remove the entire var/ folder—just the .maintenance.flag file.
How to check if Magento 2 is in maintenance mode
If you’re unsure whether maintenance mode is active, you can run:
bin/magento maintenance:status
This will return one of the following:
- Enabled – Maintenance mode is active for all users.
- Enabled for IPs: [list] – The site is in maintenance mode but whitelisted IPs can access it.
- Disabled – Maintenance mode is off and the site is fully accessible.
Customizing the maintenance mode page
By default, Magento displays a very plain 503 message. You can customize it to match your brand and reassure customers.
Disable manually via filesystem
- Go to:
errors/default/503.phtml - Edit the HTML in this file to change the message, add branding, or display contact info.
You can include:
- Your logo or header
- A message like: “We’ll be back shortly—thanks for your patience!”
- Support contact info
- Estimated downtime duration
You’ll need basic knowledge of HTML/PHP to safely edit this file.
Use a custom error theme (optional)
For a fully styled maintenance page:
- Copy your existing theme’s CSS and layout files into errors/default/.
- Modify .htaccess or nginx.conf rules to allow static files (CSS/images) to load from this folder.
This is more advanced but makes your maintenance page look professional.
SEO considerations during maintenance mode
A major benefit of Magento’s maintenance mode is that it uses a 503 Service Unavailable HTTP status code. This tells search engines:
- The site is temporarily down.
- They should try again later.
- Content should not be deindexed.
If your site shows a 404 or blank page instead, that’s a red flag to Google. You should:
- Ensure the maintenance mode returns a 503 code.
- Avoid staying in maintenance mode for more than a few hours.
- Keep robots.txt and sitemaps accessible, if possible.
For long downtimes, consider notifying Google via Search Console with temporary site messages.
Extensions for advanced maintenance mode features
Magento’s built-in maintenance mode is functional, but pretty barebones. If you want visual controls, scheduling, or rich designs, consider one of these extensions:
Maintenance Mode by Sparsh
This free module gives you an admin panel to manage:
- Custom maintenance pages with logo, message, timer
- Subscriber form to collect emails while offline
- Display mode for certain customer groups
Great for non-developers or stores that frequently update.
Mageplaza Better Maintenance
A premium option that adds:
- Visual editor for the maintenance screen
- Countdown timer and newsletter form
- Pre-set scheduling options
Amasty Custom Maintenance Page
This premium extension lets you:
- Show different messages based on device
- Schedule recurring maintenance windows
- Collect leads via Mailchimp integration
Automate maintenance mode in deployment scripts
If you use a CI/CD workflow (like GitHub Actions or Bitbucket Pipelines), you can include maintenance mode in your deployment steps.
Example Bash snippet:
bin/magento maintenance:enable –ip=YOUR.IP.ADDRESS
deploy scripts here (code pull, composer update, etc.)
bin/magento maintenance:disable
Why automate?
- Prevents customers from seeing partial updates
- Ensures maintenance mode is always disabled at the end
- Useful for staging or production deployments
Magento maintenance mode FAQs
Next steps for managing Magento 2 maintenance mode
Magento 2’s maintenance mode gives you a safe way to update your site without disrupting customers or hurting SEO. Whether you’re running updates, fixing bugs, or just prepping for a relaunch, it’s one of the most important tools in your Magento toolkit.
Start by learning the CLI commands, set up IP whitelisting for your team, and consider adding a custom message or extension for a better user experience.
Ready to upgrade your Magento experience? Professional hosting improves speeds, security, and reliability for a website and a brand that people find engaging and trustworthy.
Liquid Web offers the raw infrastructure power you need with mission-critical features that keep your store running smoothly. Most importantly, our in-house Magento experts are standing by to help with both hosting and Magento application roadblocks.
Click through below to explore all of our Magento hosting options, or chat with an expert right now to get answers and advice.
Ready to get started?
Get the fastest, most secure Magento hosting on the market
Additional resources
What is Magento Ecommerce? →
A complete beginner’s guide to the Magento Ecommerce platform
Magento security patch: What it is and how to install it →
Understand how to apply Magento security patches to keep your store protected from vulnerabilities and threats.
Best Magento ERP extensions →
Our top 10 compared so you can decide which is best for your business