How to put magento in maintenance

后端 未结 13 831
北海茫月
北海茫月 2021-02-01 21:45

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 a

13条回答
  •  攒了一身酷
    2021-02-01 22:16

    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)) {
    

提交回复
热议问题