Enabling maintenance mode in Magento 2
To enable maintenance mode in Magento 2, follow these steps:- If you have not already done so, enable the Magento command-line interface (CLI). For information about how to do this, please see this article.
- Log in to your account using SSH.
- At the command prompt, type the following command:
If you installed Magento 2 in a subdirectory, change to that directory instead. For example, if you installed Magento in a subdirectory named mag2, you would type
cd ~/public_html/mag2 .
cd ~/public_html/mag2 .
- To permit access to the front-end store from a specific IP address while Magento is in maintenance mode, type the following command. Replace xxx.xxx.xxx.xxx with the IP address for which you want to allow access:
If you do not know your IP address, you can visit http://ipfinder.us.
- To enable maintenance mode, type the following command:
- To disable maintenance mode and re-enable the store for all visitors, type the following command:
Enabling maintenance mode in Magento 1.9 and older versions
To enable maintenance mode in Magento 1.9 and older versions, follow these steps:- Log in to your account using SSH.
-
Change to the directory where you installed Magento. For example, if Magento is in the document root directory, type
cd ~/public_html. - Use your preferred text editor to open the index.php file.
- Locate the following line in the index.php file:
- To allow multiple IP addresses, separate them with a comma. For example:
- If you do not know your IP address, you can visit http://ipfinder.us.
- Locate the following line in the index.php file:
- Save your changes to the index.php file and exit the editor.
- At the command prompt, type the following command:
- To disable maintenance mode and re-enable the store for all visitors, type the following command: