17

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

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

任何帮助,将不胜感激。

谢谢你。

4

13 回答 13

30

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

于 2012-04-01T03:13:56.340 回答
24

我经常用这个。http://incho.net/ecommerce/magento/maintenance-mode-in-magento/

重要的部分是:

打开:在根目录及以上第 57 行添加的 index.php(记得编辑“允许”数组以包含您希望能够访问该站点的 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)) {
于 2010-11-17T04:28:38.103 回答
11

Just add a blank file called maintenance.flag to your root.. job done

A neater solution is to use this extension.

it allow you to set the store up so that once logged into the back end you have access to the front + a few other neat features

于 2012-03-27T09:35:42.250 回答
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;
}
于 2012-07-23T12:59:23.370 回答
0

您可以查看这篇文章,它包含有关将存储放入多个 IP 的维护的信息,并有一些工作示例和所需文件:

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

于 2014-02-05T09:48:53.687 回答
0

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

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

打开.htaccess文件夹并将默认页面从 重命名index.phpindex.html。重启阿帕奇。完成后将默认页面重命名为index.php.

它应该工作。

于 2012-09-05T20:57:51.067 回答
0

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

或者

如果您想在代码上获得乐趣,请创建maintenance.flag将您的站点置于维护模式的文件。如果你想改变它的模板然后转到 errors/default/503.phtml文件。只是改变它的设计。

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

于 2012-08-02T18:57:57.660 回答
0

看看这个http://www.magentocommerce.com/magento-connect/all4coding-offline-maintenance-page.html它提供了你正在寻找的东西。与 magento 1.4 - 1.8 兼容。

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

于 2014-04-10T01:11:34.353 回答
0

Magento内置了maintenance.flag支持。从这里查看

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

于 2012-01-25T22:54:46.533 回答
0

我按照本教程将我的 Magento 商店置于维护模式,您可以尝试如下:

  1. 在您的 magento 根目录中创建一个文件名 maintenance.flag。这个文件下的内容无所谓,你可以留空。

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

于 2014-04-04T09:32:06.170 回答
0

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

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

    $ip = $_SERVER['REMOTE_ADDR']; $allowed = array('xxxx','yyyy');

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

希望这可以帮助。

于 2016-08-26T10:22:57.843 回答
0

如果您只需要在前端将 Magento 置于维护模式,让管理员启用身份验证,您可以尝试以下步骤:

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

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

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

    $ touch maintenance.flag
    

该解决方案的灵感来自 Opencart 中使用相同行为的维护模式。

于 2017-10-25T17:14:39.290 回答
-2

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

于 2016-03-04T08:53:56.783 回答