How to put magento in maintenance

后端 未结 13 832
北海茫月
北海茫月 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:15

    If you need to put Magento in maintenance mode only in frontend, leaving admin enabled for authentication you can try these steps:

    1. Open index.php (from Magento root installation)
    2. Search for the content below (around line 63):

      if (file_exists($maintenanceFile)) {
      
    3. Replace for:

      if (file_exists($maintenanceFile) && !preg_match('/^\/(admin|index.php\/admin)/', $_SERVER['REQUEST_URI'])) {
      
    4. Create a blank file named maintenance.flag in your Magento root installation:

      $ touch maintenance.flag
      

    This solution was inspired in the maintenance mode used in Opencart that uses the same behavior.

提交回复
热议问题