Maintenance Mode is a useful to temporarily disable a website to test the site before it goes live, or do maintenance tasks such as updating, fixing the bug, etc. 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.
Magento detects the maintenance mode as follows:
If the var/.maintenance.flag does not exist, the maintenance mode is off and the Magento website runs normally.
If var/.maintenance.flag exists, the maintenance mode is on.
To enable Maintenance Mode in Magento 2 ,use the below command:
|php bin/magento maintenance:enable [--ip=<ip address>]|
If you are looking to enable the maintenance mode for any particular IP, pass the IP in the above-mentioned command.
|php bin/magento maintenance:enable --ip=192.168.1.10|
By using the above command, you will enable the maintenance mode for IP address 192.168.1.10.
To Disable Maintenance Mode in Magento 2 ,use the below command:
|php bin/magento maintenance:disable [--ip=<ip address>]|
If you are looking to disable the maintenance mode for any particular IP, pass the IP in the above-mentioned command.
Steps to Custom Maintenance mode Page in Magento 2:
<h1>Service Temporarily Unavailable</h1>
The server is temporarily unable to service your request due to maintenance downtime or capacity problems.
Use the following command to allow access to the frontend store from a specific IP address while Magento website is in maintenance mode:
|php bin/magento maintenance:allow-ips <ip address> .. <ip address> [--none]|
We hope the above blog is helpful to understand how to Enable and Disable maintenance mode in Magento 2. You can also use our Magento 2 Maintenance Mode extension to design your own custom maintenance page for your online store and update your visitors about your website maintenance status. If you have any query then you contact us or let us know in the comment section.