How to Turn On/Off Maintenance Mode in Magento 2

Facing issues while turning on/off maintenance mode on your Magento 2 store?

Magento 2 maintenance mode is an exceptional feature that permits you to disable your online store’s access temporarily. When you enable this mode, your website visitors will observe a designated maintenance page instead of your store’s front end.

The maintenance page will reflect the ongoing maintenance message and the relevant downtime information. This option is highly useful when you wish to perform updates, upgrades, or other maintenance tasks on your website.

How to Check if the Maintenance Mode is Active on Your Store?

Checking the status of maintenance mode on your Magento 2 store is super easy, all you need to do is follow these steps-

  • Search for ‘ var / .maintenance.flag ’ in your Magento. If you locate this file, it means the maintenance mode is enabled for your store. In contrast, the absence of this file reflects maintenance mode is disabled.

  • Another way to find out whether your website is in maintenance mode is to look for the file var/.maintenance.ip , if this file is present, maintenance mode will get turned off specifically for the authorized IP addresses listed in this file.

Prerequisites to Enable Maintenance Mode on Your Magento 2 Store

Maintenance mode will take down your website for a specific time and nobody wants to lose customers because of maintenance. Hence, you need to follow some guidelines to ensure a seamless user experience. Here are some prerequisites to follow while entering the maintenance mode-

  • Get full access to the Magento 2 admin panel along with administrator privileges.

  • Create a complete backup of your Magento 2 store, including all the files and database. It will be beneficial in recovering your website in case anything goes wrong.

  • Spend time designing the maintenance page that would display relevant information such as the reason, anticipated downtime, and contact information.

  • Don’t forget to put your Magento 2 store in developer mode as it prevents cached content from affecting the maintenance page display.

  • Plan your downtime during low-traffic periods to avoid major losses.

  • Pick a strategy to inform your customers about the downtime. This could include regular email, social media posting, push notifications, or a banner displaying the alert.

  • Brief your customers and team with the specific start and end time for the maintenance.

How to Enable/ disable maintenance mode in Magento?

Let’s discuss how you can enable Maintenance mode on your Magento 2 store. All you need to do is enter the following command-

php bin/magento maintenance:enable [–ip=<ip address>]

For instance, if you use the below command, you will enable the maintenance mode with exceptions.

php bin/magento maintenance:enable –ip= –ip=

The above code will disable the maintenance mode specifically for two IP addresses and Usually, the IP address of the developer debugging your website is included in this code.

Similarly, to disable maintenance mode on your Magento 2 store, type in the following command-

php bin/magento maintenance:disable [–ip=<ip address>]

Additionally, if you wish to know the current status of the maintenance mode, use the below command:

php bin/magento maintenance:status

Last Verdict

We hope that our comprehensive guide helped you understand the entire process of enabling/disabling maintenance mode on your Magento 2 store. Switching to this mode allows you to carry out important updates, upgrades, or other maintenance tasks on your website. It displays a designated maintenance page along with the ongoing maintenance message.

Need assistance with your Magento 2 store maintenance?

magePoint is a well-established Magento 2 development company with over 9 years of experience. Our dedicated team is known to deliver top-notch Magento maintenance services with minimal downtime. Opt for our services to overcome ongoing issues in your store and improve its performance. Contact us for more information.