How to Enable Magento 2 Maintenance Mode?

Enable Magento 2 Maintenance Mode

Are you looking to enable Magento 2 maintenance mode?

Maintenance mode is helpful during website maintenance. It shows a user-friendly notice to the website visitors that your website is under maintenance instead of a broken page.

It also allows developers and Magento owners to deploy any update, patch, or changes to the Magento store while keeping it away from the live visitors.

This quick tutorial will show you how you can put your Magento site in maintenance mode.

What to do before enabling Magento 2 Maintenance Mode?

Turning the maintenance mode ON without preparation is not a smart move.

Enabling maintenance mode will make the site inaccessible to the number of users, and they will not be able to understand why the site goes under maintenance and how long it will be in the maintenance.

Some of the measures you should take care of before moving to maintenance mode.

  1. Notify the subscribers that your website will go to maintenance in advance. Many eCommerce stores send an email or show a message on their site showing the time and date of maintenance.
  2. Taking the entire backup. You should always take the complete backup before making any significant changes to the site.
  3. Exclude the pages that are critical from the maintenance mode. Such as support pages, KB, login pages, — keep them live while the website is in maintenance mode.

Enabling maintenance mode in Magento 2 with CLI

Enable Magento 2 Maintenance Mode

Follow these steps to enable maintenance mode in Magento 2:

  1. Enable the Magento command-line interface (CLI)
  2. Log in to your account via SSH.
  3. Go to the directory where the Magento is installed. Use the below code:
cd ~/public_html
  1. Add the IP address you want to permit access to the Magento store. Use the below command:
bin/magento maintenance:allow-ips xxx.xxx.xxx.xxx

Change the xxx.xxx.xxx.xxx with IP address. Find your IP address.

  1. Enable the Magento maintenance mode with the following command
bin/magento maintenance:enable

The command will put the Magento 2 store in maintenance mode. Only the IP address you allowed will be able to access the store. All other users and visitors will see a page notifying them that the store is under maintenance.

  1. Disabling the maintenance mode will open the store for everyone again. Use the following command:
bin/magento maintenance:disable
  1. You can check the maintenance mode status any time with the following command:
bin/magento maintenance:status

Wrap Up

That’s it. 

Copy-paste the commands to enable/disable the Magento 2 maintenance mode.

If this tutorial helped you, you would love our Breeze panel. Subscribe to the blog to get updates.

Latest Magento Tips, Guides, & News

Stay updated with new stuff in the Magento ecosystem including exclusive deals, how-to articles, new plugins, and more. 100% Magento Goodness, a promise!

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top

πŸŽ‰ CYBER MONDAY SAVINGS πŸŽ‰

75% OFF on
ALL PLANS

Receive the coupon as soon as you
submit the email address. πŸš€