Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to put magento in maintenance

Is it possible to put a magento site under an maintenance flag so that visitors will get a message that the site is under construction? I can't find this setting in the admin area.

Another solution will also be welcome.

Any help would be appreciated.

Thank you.

like image 940
Justmac Avatar asked Nov 17 '10 02:11

Justmac


People also ask

How do I enable production mode in Magento 2?

$ php bin/magento deploy:mode:set production Enabled production mode. Congrats! Now your store is running in production mode.

What is the CLI command to create an admin account in Magento?

–admin-firstname-> Admin user's first name (required). –admin-lastname-> Admin user's last name (required). Note: If you are editing an existing user then only the first name, last name, and password can be edited.


2 Answers

I use this often. http://inchoo.net/ecommerce/magento/maintenance-mode-in-magento/

The important part is:

Open: index.php in root and above line 57 add (remembering to edit the ‘allowed’ array to contain the IP’s you want to be able to access the site);

$ip = $_SERVER['REMOTE_ADDR'];
$allowed = array('1.1.1.1','2.2.2.2'); // these are the IP's that are allowed to view the site.

then change the line

if (file_exists($maintenanceFile)) {

to

if (file_exists($maintenanceFile) && !in_array($ip, $allowed)) {
like image 30
clockworkgeek Avatar answered Sep 22 '22 13:09

clockworkgeek


To enable maintenance mode in Magento, just create empty maintenance.flag file in the root of your Magento store.

like image 175
Dakshika Avatar answered Sep 19 '22 13:09

Dakshika