With a big catalog of 224+ extensions for your online store
How to Enable or Disable Maintenance Mode in Magento 2
Maintenance Mode is a useful and important mode in Magento. If you want to temporarily disable your website to test your site before it goes live, or do maintenance tasks such as updating, fixing the bug, etc., you can enable the maintenance mode.
When your website is in maintenance mode, store visitors will receive a Service Temporarily Unavailable message in their web browser instead of the frontend store. However, it is able for authorized IP addresses to access and view the store normally. We also have a post on how to enable or disable the maintenance mode in Magento 2 (Adobe Commerce) via command line that you can take a look at.
So, in this article, I will give you the detailed instructions to enable/ disable maintenance in both Magento 1 and Magento 2.
& Maintenance Services
Make sure your store is not only in good shape but also thriving with a professional team yet at an affordable price.
Get Started1. What is Magento 2 maintenance mode?
Magento 2 maintenance mode is a feature that allows you to temporarily disable access to your online store’s frontend while you perform updates, upgrades, or other maintenance tasks. When maintenance mode is enabled, visitors to your website will see a designated maintenance page instead of the regular store pages. This maintenance page typically includes a message informing users that the website is undergoing maintenance, along with any relevant information about the downtime.
You can check if the maintenance mode is enable or not by this follow way:
- Maintenance mode will turn off, and Magento will work normally when ‘var / .maintenance.flag’ doesn’t exist
- When ‘var / .maintenance.flag’ exists: Maintenance mode is on, except where ‘var / .maintenance.ip’ is present.
2. Installing maintenance mode preparation checklists
Before configuring Magento 2 maintenance mode, makr sure that you have prepared the followings:
-
Access to Admin Panel: Make sure you have access to the Magento 2 admin panel with administrator privileges.
-
Backup: Perform a full backup of your Magento 2 store, including files and the database. This ensures that you have a safe copy in case anything goes wrong during maintenance mode setup.
-
Maintenance Page Design: Prepare or choose a maintenance page design that displays relevant information to your customers, such as the reason for maintenance, expected downtime, and any alternative contact information.
-
FTP/SSH Access: Maintain access to your store’s files via FTP or SSH. This may be needed to upload the maintenance page, modify files, or revert changes.
-
Developer Mode: Put your store in developer mode to prevent cached content from affecting the display of the maintenance page.
-
Readiness for Downtime: Be ready for your store to be temporarily offline during maintenance. Plan this during low traffic periods to minimize the impact on customers.
-
Notification Strategy: Determine how you will inform your customers about the upcoming maintenance. This could involve sending emails, posting on social media, or displaying a notice on your website before maintenance begins.
-
Scheduled Time: Set a specific start and end time for the maintenance. Clearly communicate this schedule to your team and customers.
By having these elements in place, you’ll be better prepared to smoothly configure Magento 2 maintenance mode without causing inconvenience to your customers and ensuring a seamless user experience during the maintenance period.
3. Enable/ disable maintenance mode in Magento
Enable or Disable Maintenance Mode in Magento 1
To enable/ disable maintenance mode, following the below steps:
- Log in to your Magento administrator account via SSH
- Change to the directory where Magento is installed. For example, if you install Magento in the document root directory, type cd ~/public_html
- Open the index.php file by using your preferred text editor.
- Place the following line in the index.php file:
$maintenanceFile = 'maintenance.flag';
Add the following two lines after this line. where xxx.xxx.xxx.xxx is the IP address for which you want to allow access to the front-end store while Magento is in maintenance mode
$ip = $_SERVER['REMOTE_ADDR'];$allowed = array('xxx.xxx.xxx.xxx');
Note:
To exempt multiple IP addresses from the maintenance model, separate them with a comma.
For example
$allowed = array('10.1.0.127','10.1.0.252');
In case you do not know your own IP address, you can access to http://ipfinder.us/
- Place the following line in the index.php file:
if (file_exists($maintenanceFile)) {
Change the line to look like the following:
if (file_exists($maintenanceFile) && !in_array($ip, $allowed)) {
-
Exit the editor after saving your changes to the index.php file.
-
Type the following command on the command prompt:
touch maintenance.flag
After going through these above steps, you set the able status for maintenance mode. Now once you access to Magento website from an authorized IP address, the store displays normally. However, a Service Temporarily Unavailable message will be shown in the web browsers of all other visitors.
- To disable maintenance mode and permit all visitors to access the frontend store, type the following command:
rm maintenance.flag
Enable or Disable Maintenance Mode in Magento 2
Firstly, let me show you how to enable/ disable the maintenance mode in Magento 2 (Adobe Commerce), following the below process.
Explain
Magento detects the maintenance mode as follows:
If var/.maintenance.flag
does not exist, the maintenance mode is off and Magento website runs normally.
If var/.maintenance.flag
exists, the maintenance mode is on.
However, the maintenance status also depends on the file var/.maintenance.ip
. This file will make some exceptions so the Magento 2 maintenance mode can be off even if the var/.maintenance.flag
exists.
Now, you will be instructed to enable or disable the maintenance mode by using the following commands.
Enable The Maintenance Mode in Magento 2
Command usage
php bin/magento maintenance:enable [--ip=<ip address>]
For example
php bin/magento maintenance:enable --ip=192.168.1.10 --ip=192.168.1.11
By using the above command, you will disable the maintenance mode for two IP addresses 192.168.1.10 and 192.168.1.11. The IP address of the developer who wants to debug your website is probably usually included in the above command.
Disable The Maintenance Mode in Magento 2
Command usage
php bin/magento maintenance:disable [--ip=<ip address>]
Show Maintenance Status
To know the current status of the maintenance mode, use the below command:
Command usage
php bin/magento maintenance:status
Exempt IP Addresses From Maintenance Mode
To allow access to the frontend store from a specific IP address while Magento website is in maintenance mode, type the following command:
Command usage
php bin/magento maintenance:allow-ips <ip address> .. <ip address> [--none]
For example
php bin/magento maintenance:allow-ips 192.168.1.10 192.168.1.11
Learn more: Enable or Disable maintenance mode via Command Line in Magento 2
Mageplaza Magento Support & Maintenance Services
Mageplaza understands the vital role that your Magento store plays in your business success, so we offer the Magento Support and Maintenance Services to help business owner store solve problems in using, operating, maintaining, and maintaining online stores on Magento platform. Our dedicated Support & Maintenance Services are tailored to ensure your store’s continuous optimal performance, security, and growth.
The expert team of Magento professionals is here to provide timely assistance, resolve issues, and keep your store up-to-date with the latest advancements. From regular updates and security patches to troubleshooting and performance optimization, we’ve got you covered.
With Mageplaza’s Support & Maintenance Services, you can focus on your core business while we take care of your Magento store’s well-being. Experience seamless operations, enhanced security, and unmatched reliability – all backed by Mageplaza’s commitment to excellence.
Elevate your Magento store’s performance and secure its future with Mageplaza Support & Maintenance Services. Your success is our priority.
& Maintenance Services
Make sure your store is not only in good shape but also thriving with a professional team yet at an affordable price.
Get StartedConclusion
The Maintenance Mode allows online stores to conduct tests and make essential adjustments by showing customers the unavailable notice instead of the usual front pages. We have shown you the shortest process to enable/ disable maintenance mode in Magento 2, and now it is your turn to do it. If you have any questions, feel free to ask us!
Our support team is enthusiastic about providing excellent Magento extensions for you with FREE Lifetime update, FREE 1-year support, risk-free 60-day money back. Let us help you quickly grow your online business!
Looking for Magento Development Company?
8+ years of experiences in e-commerce & Magento has prepared us for any challenges, so that we can lead you to your success.
Get free consultantRecent Tutorials
How to insert Order Attributes to Transactional Emails
How to insert Order Attributes to Transactional Emails
How to add Order Attributes to PDF Order Template
Explore Our Products:
People also searched for
- magento maintenance mode
- magento 2 maintenance mode only frontend
- maintenance mode magento 2
- magento maintenance.flag
- disable maintenance mode magento 2
- magento 2 maintenance mode allow ip
- magento maintenance mode disable
- magento set maintenance mode
- take magento out of maintenance mode
- magento 2 maintenance mode allow ip not working
- disable maintenance mode magento
- magento 2 enable maintenance mode
- magento 1 maintenance mode
- magento disable maintenance mode
- new york magento store maintenance
- magento maintenance support
- magento2 maintenance mode
- magento enable maintenance mode
- magento store maintenance
- magento 2 maintenance mode access admin
- magento 2 set maintenance mode
- how to disable maintenance mode in magento 2
- maintenance flag magento 2
- maintenance mode magento
- magento maintenance mode allow ip
- magento 1 enable maintenance mode
- magento 2 maintenance services
- magento 2 check maintenance mode
- how to enable maintenance mode in magento 2
- magento 2 remove maintenance mode
- maintenance mode disable magento 2
- magento site maintenance mode
- magento maintenance service
- how to put magento in maintenance mode
- maintenance flag magento
- 2.3.x, 2.4.x
Stay in the know
Get special offers on the latest news from Mageplaza.
Earn $10 in reward now!