How to put magento in maintenance

2019-03-09 21:32发布

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

Another solution will also be welcome.

Any help would be appreciated.

Thank you.

14条回答
ゆ 、 Hurt°
2楼-- · 2019-03-09 22:03

Check out this http://www.magentocommerce.com/magento-connect/all4coding-offline-maintenance-page.html it provide exactly what you are looking for. compatible with magento 1.4 - 1.8.

You can also display the maintenance page with your design theme.

查看更多
我想做一个坏孩纸
3楼-- · 2019-03-09 22:04

Thats what I add to the index in order to be able to continue working from different IPs:

//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;
}
查看更多
ら.Afraid
4楼-- · 2019-03-09 22:04

I followed this tutorial to put my Magento store to maintenance mode, you may try as below:

  1. Create a file name maintenance.flag in your magento root directory. Contents under this file doesn’t matter, you can keep it empty.

  2. Change the maintenance file (located in magento root -> errors -> default directory) to show proper message when user visits your website. Hop this helps

查看更多
Summer. ? 凉城
5楼-- · 2019-03-09 22:10

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)) {
查看更多
对你真心纯属浪费
6楼-- · 2019-03-09 22:10

I followed this tutorial http://magentoexplorer.com/how-to-show-and-customize-magento-maintenance-mode-page to enable maintenance mode page in Magento, you need to create and upload maintenance.flag file to Magento root folder, however there are some more step for a good Maintenance mode like.

  1. Add exception during maintenance (allow specific IP to visit your site during maintenance). In index.php, add these lines

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

  2. Edit maintenance mode page Edit maintenance mode page in /errors/default/503.phtml Remove wrap in /errors/default/page.phtml

Hope this helps.

查看更多
再贱就再见
7楼-- · 2019-03-09 22:11

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.

查看更多
登录 后发表回答