Knowledge Base
MilesWeb / CMS FAQ

Learn to Enable and Disable Magento Maintenance Mode

Approx. read time : 3 min

Maintenance mode is not only an important but useful mode in Magento. This mode is enabled in case you want to disable your website temporarily prior to making it live or performing maintenance tasks such as bug fixing, updating, etc. When your website is in maintenance mode, store visitors receive a Service Temporarily Unavailable message in their web browser rather than the frontend store. But you can access it from authorized IP addresses for checking the store normally.

Steps to Enable and Disable Maintenance Mode in Magento 1

1. Login to your Magento administrator account using SSH.

2. Switch to the directory where Magento is installed. For instance, if you installed Magento in the document root directory, type the below command:

3. Using your preferred text editor, open the index.php file.

4. Paste the below line in the index.php file:

5. Add the below two lines after this. Where xxx.xxx.xxx.xxx is the IP address for which you want to enable the access to the front-end store while Magento is in maintenance mode.

Note: To discover multiple IP addresses from the maintenance model, separate them with a comma.

For example:

6. For knowing your own IP address, access the website: http://ipfinder.us/

7. Add the below line in the index.php file:

8. Change the line in the following way:

9. Save your changes to the index.php file and close the editor.

10.On the command prompt enter the below command:

Once you complete with the above steps, your status is set to maintenance mode. After accessing the Magento website from an authorized IP address, the store will display normally. But when your visitors browse the website, they will get a Service Temporarily Unavailable message displayed.

For disabling the maintenance mode and allowing the access of the frontend store to all visitors, type the following command:

Steps to Enable or Disable Maintenance Mode in Magento 2

Magento detects the maintenance mode in the below way:

  • If var/.maintenance.flag is not available, the maintenance mode is off and Magento website runs normally.
  • If var/.maintenance.flag is present, the maintenance mode is on.

But, the maintenance status is also based on the file var/.maintenance.ip. There will some exceptions made by this file to turn off the Magento 2 maintenance mode even if var/.maintenance.flag is present.

1. Login to your account using SSH.

2. Go to the file where your Magento is installed in.

3. Add the below command to the command prompt of SSH:

For example

4. With the use of the above command, you will enable the maintenance mode for two IP addresses 192.168.1.10 and 192.168.1.11. The developer’s IP address who wants to debug your website is usually included in the above command.

5. To disable the maintenance mode use the below command:

6. To check the current status of the maintenance mode, use the below command:

Steps to Exempt IP Addresses From Maintainance Mode

For enabling the access to the frontend store from a specific IP address when you put Magento website in maintenance mode, type the below command:

For example:

Conclusion

The above are the short and simple processes to enable/disable maintenance mode in Magento 2. This guide will help you to manage the maintenance mode in Magento easily.

Avatar
Pallavi is a Digital Marketing Executive at MilesWeb and has an experience of over 4 years in content development. She is interested in writing engaging content on business, technology, web hosting and other topics related to information technology.
Need help? We’re always here for you.
Register Your Free Domain Name
OFFER EXPIRES IN
04
min
59
sec