How to Run Enable/Disable Maintenance Mode in Magento 2?

Enable/Disable Maintenance Mode in Magento2 

Maintenance Mode is an important mode in Magento 2. In case you want to temporarily disable your website to update or fix a bug, then you should give your website to maintenance mode.
So today I will show you the command line of Magento 2 to enable or disable maintenance mode.

1. Main keynotes

  • First, the mode is off if the file var/.maintenance.flag does not exist.
  • And if var/.maintenance.flagexists, the mode is on. But it 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

2.  Enable the maintenance mode:

php bin/magento maintenance:enable [--ip=<ip address>]
  • Example:
php bin/magento maintenance:enable --ip= --ip=

So you will disable the maintenance mode for two IP address and There is probably usually the Ip address of developer who wants to debug your website.

  • To disable the maintenance mode:
php bin/magento maintenance:disable [--ip=<ip address>]
  • To show status:
php bin/magento maintenance:status

Exempt IP addresses from Maintainance mode

php bin/magento maintenance:allow-ips <ip address> .. <ip address> [--none]
  • Example
php bin/magento maintenance:allow-ips

These steps I mentioned above are the shortest process for you to Enable/Disable Maintenance Mode in Magento 2. With this guide, you can manage the Maintenance Mode in Magento 2 easily. Every store has a Maintenance Mode in Magento 2 with many attributes.

I hope this information will be useful for you to manage your store. For more  Magento tutorial you can visit Webnexs Magento Knowledge Base.





Leave a Reply

Your email address will not be published. Required fields are marked *