Putting Magento 2.x into maintenance mode can be done by placing a file named .maintenance.flag in the var folder. (yourdomain.co.uk/var/.maintenance.flag)
When a Magento site is put into maintenance mode even administrators will not be able to see the normal site or log in.
To allow administrators to access the site during maintenance mode you first need to know their IP addresses.
Once you know which IP addresses you would like to allow access to the maintenance mode Magento site, you just need to place the IP’s in a file called .maintenance.ip inside the var folder. (yourdomain.co.uk/var/.maintenance.ip)
When the IP’s are in yourdomain.co.uk/var/.maintenance.ip then anyone who’s IP is in there will not see a maintenance page and will instead see the normal site. Whereas anyone who’s IP is not in this file will see the maintenance page.
Last modified: 14/08/2019