如何将magento投入维护

时间:2010-11-17 02:59:36

标签: magento webshop magento-1.4

是否可以将magento网站置于维护标志下,以便访问者收到该网站正在建设中的消息? 我在管理区域找不到此设置。

另一种解决方案也将受到欢迎。

任何帮助都将不胜感激。

谢谢。

13 个答案:

答案 0 :(得分:29)

要在Magento中启用维护模式,只需在Magento商店的根目录中创建空的 maintenance.flag 文件。

答案 1 :(得分:23)

我经常使用它。 http://inchoo.net/ecommerce/magento/maintenance-mode-in-magento/

重要的部分是:

  

打开:index.php在root和57行以上添加(记住编辑'allowed'数组以包含您希望能够访问该站点的IP);

$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.
     

然后更改行

if (file_exists($maintenanceFile)) {
     

if (file_exists($maintenanceFile) && !in_array($ip, $allowed)) {

答案 2 :(得分:11)

只需在您的根目录中添加名为maintenance.flag的空白文件即可完成

更简洁的解决方案是使用this extension

它允许您设置存储,以便一旦登录到后端,您就可以访问前端+其他一些简洁的功能

答案 3 :(得分:6)

这就是我添加到索引中的内容,以便能够继续使用不同的IP:

//EGS to show a maintenance page but be able to work
$ip = $_SERVER['REMOTE_ADDR'];

// these are the IP's that are  allowed to view the site:
$allowed = array('111.111.111.111', '222.222.222.222');

if (file_exists($maintenanceFile) && !in_array($ip, $allowed)) { 
    include_once dirname(__FILE__) . '/errors/503.php';
    exit;
}

答案 4 :(得分:0)

Magento内置了 maintenance.flag 支持。请查看

http://www.nicksays.co.uk/2010/07/enabling-magento-maintenance-mode/

答案 5 :(得分:0)

这些都是很好的模块,可以随时将您的magento网站置于维护模式。 http://www.magentocommerce.com/magento-connect/store-maintenance.html

OR

如果您想要处理代码,那么请创建maintaince.flag文件,将您的网站置于维护模式。如果你想改变它的模板然后转到 errors/default/503.phtml个文件。只需改变它的设计。

这是一个简单的解决方案。

答案 6 :(得分:0)

以下内容适用于apache安装(需要与其他人核对)。

您可以在维护html页面下创建自己的自定义网站index.html并将其放在安装的根目录中。

打开.htaccess文件夹,将默认页面从index.php重命名为index.html。重启Apache。完成后,将默认页面重命名为index.php

它应该有用。

答案 7 :(得分:0)

您可以查看这篇文章,它有关于将商店存放到多个IP的维护中的信息,并且有一些工作示例和所需文件:

http://blog.magalter.com/page/how-to-temporarily-block-magento-store-access-put-website-to-maintenance-mode

答案 8 :(得分:0)

我跟着this tutorial将我的Magento商店置于维护模式,您可以尝试如下:

  1. 在magento根目录中创建文件名maintenance.flag。此文件下的内容无关紧要,您可以将其保留为空。

  2. 更改维护文件(位于magento root - > errors - >默认目录中),以便在用户访问您的网站时显示正确的消息。 跳这个帮助

答案 9 :(得分:0)

查看此http://www.magentocommerce.com/magento-connect/all4coding-offline-maintenance-page.html,它提供了您正在寻找的内容。兼容magento 1.4 - 1.8。

您还可以使用您的设计主题显示维护页面。

答案 10 :(得分:0)

我按照本教程http://magentoexplorer.com/how-to-show-and-customize-magento-maintenance-mode-page启用了Magento中的维护模式页面,您需要创建并将maintenance.flag文件上传到Magento根文件夹,但是还有更多步骤可以实现良好的维护模式,如。

  1. 在维护期间添加例外(允许特定IP在维护期间访问您的站点)。在index.php中,添加这些行

    $ ip = $ _SERVER ['REMOTE_ADDR']; $ allowed = array('x.x.x.x','y.y.y.y');

  2. 编辑维护模式页面 在 /errors/default/503.phtml 中编辑维护模式页面 在 /errors/default/page.phtml
  3. 中删除换行

    希望这有帮助。

答案 11 :(得分:0)

如果您需要将Magento置于前端的 维护模式中,请启用admin进行身份验证,您可以尝试以下步骤:

  1. 打开index.php(来自Magento root安装)
  2. 搜索以下内容(第63行):

    if (file_exists($maintenanceFile)) {
    
  3. 替换为:

    if (file_exists($maintenanceFile) && !preg_match('/^\/(admin|index.php\/admin)/', $_SERVER['REQUEST_URI'])) {
    
  4. 在Magento root安装中创建一个名为 maintenance.flag 的空白文件:

    $ touch maintenance.flag
    
  5. 此解决方案的灵感来自于Opencart中使用相同行为的维护模式。

答案 12 :(得分:-2)

在Magento商店的根目录中创建一个空的maintenance.flag文件。