Hello everyone. Maintenance Mode is important mode in Magento 2. In the case which you want to temporarily disable your website to update or fix bug, you should give your website to maintenance mode.

Today I will show you the command line of Magento 2 to enable or disable this mode.

Run Enable/Disable Maintenance Mode
Run Enable/Disable Maintenance Mode
  • The mode is off if the file var/.maintenance.flag does not exist.
  • If var/.maintenance.flag exists, 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 ar/.maintenance.flag exists
  • To enable the mainenance 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 are 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

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

Thank you for reading this post and see you in other posts from Magestore!

Clear Directories during Development in Magento 2
How to Create Widget in Magento 2

Leave a Reply

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