magento on maintenance mode open only on your ip

magento on maintenance mode open only on your ip

Hello All

 

Put magento on maintenance mode and it open only on your ip

Put magento on maintenance mode and it open only on your ip

Today I am going to explain you how to put magento on maintenance mode. That maintenance mode will show to all other user user beside you. So can can work on a live environment if there is any issue which is very useful.

Some time we all face a problem that something is not working on live environment while it is working on staging. So we have to test it on live environment but it is more difficult to put echo/ die on live site.

you can you do your work by using these steps so only you are able to open site while other see site is under maintenance mode.

Step 1 : put a file on your root with the name “maintenance.flag”

Step 2 : open you index file and find the code

if (file_exists($maintenanceFile) ) {
 include_once dirname(__FILE__) . '/errors/503.php';
 exit;
 }

Now update the code with that code

$ip = $_SERVER['REMOTE_ADDR']; // you can check your ip by http://who.is/
 if (file_exists($maintenanceFile) && $ip != "your ip address" ) {
 include_once dirname(__FILE__) . '/errors/503.php';
 exit;
 }

that it . Your site is ready to test on live mode without any problem. :)

You may also like...

Creating a Shopify App using Laravel How to Create Custom WordPress Plugin? How to Build a Telegram Bot using PHP How to Convert Magento 2 into PWA?