How to Enable or Disable Maintenance Mode in Magento 2
Have you ever seen the temporary caution board that says working in progress? These kinds of boards are used to notify people about the current state of that place. Now, what if you want a similar concept in your Magento 2 store?
Yes, it is possible with the feature of maintenance mode.
Maintenance mode is a shortcut to serve a temporary error notification to all visitors of your store and inform them to come back later.
You may want to enable maintenance mode while setting up a new theme, configuring an extension to change website behaviour, upgrading to latest Magento 2, implementing some customization or fixing a security flaw.
Simply enabling the maintenance mode shows users broken websites for a while. When Magento is in maintenance mode, visitors see maintenance-enabled notification messages in their web browsers instead of the store. However, authorized IP addresses can still view the store normally.
It displays the error message as shown below:
Follow the below method to either enable or disable maintenance mode in Magento 2 as per your requirements.
Method to Enable or Disable Maintenance Mode in Magento 2
Enable The Maintenance Mode in Magento 2
Using Command :
1 |
php bin/magento maintenance:enable [--ip=<ip address>] |
If you want to enable the maintenance mode for particular IP then pass that IP in the above command.
By using the above command, you can enable the maintenance mode for two IP addresses. The IP address of the developer who wants to debug your website is probably usually included in the above command.
otherwise pass the below command:
1 |
php bin/magento maintenance:enable |
Disable The Maintenance Mode in Magento 2
Using Command :
For particular IP:
1 |
php bin/magento maintenance:disable [--ip=<ip address>] |
To disable the maintenance mode:
1 |
php bin/magento maintenance:disable |
Show Maintenance Status
Use the below command to know the current status of the maintenance mode:
1 |
php bin/magento maintenance:status |
Exempt IP Addresses From Maintainance Mode
Use the following command to allow access to the frontend store from a specific IP address while Magento website is in maintenance mode:
1 |
php bin/magento maintenance:allow-ips <ip address> .. <ip address> [--none] |
That’s it!
The above solution is the quickest and simplest way to enable/disable maintenance mode in Magento 2 as per the need of the hour.
If you still have any doubts regarding this post, just mention them in the Comments section below.
I would be happy to help.
Feel free to share the solution with Magento Community via social media.
Thank You.
Prev
How to Change Database Name in Magento 2
How to Uncancel Order Directly From Database in Magento
Next