Magento’s maintenance mode allows you to temporarily take your store offline while performing updates, testing, or development. During this time, visitors see a “Service Temporarily Unavailable” message, while authorized IP addresses can still access the store normally. On ruachost.com, you can enable maintenance mode for both Magento 2 and Magento 1.x.

 

Why Use Maintenance Mode?

  • Prevents customers from seeing errors during updates.

  • Protects data integrity while applying patches or extensions.

  • Allows developers to test changes safely.

 

Enabling Maintenance Mode in Magento 2

  1. Log in to your hosting account via SSH.

  2. Navigate to your Magento installation directory:

    Bash
    
    cd ~/public_html
    

    (If installed in a subdirectory, adjust accordingly, e.g. cd ~/public_html/mag2)

  3. To allow access from a specific IP address while in maintenance mode:

    Bash
    
    bin/magento maintenance:allow-ips xxx.xxx.xxx.xxx
    

    (Replace xxx.xxx.xxx.xxx with your IP address. You can find it at http://ipfinder.us)

  4. Enable maintenance mode:

    Bash
    
    bin/magento maintenance:enable
    

     

  5. To disable maintenance mode and re‑enable the store for all visitors:

    Bash
    
    bin/magento maintenance:disable
    
  6. To check the current status:

    Bash
    
    bin/magento maintenance:status
    
     

Enabling Maintenance Mode in Magento 1.9 and Older

  1. Log in to your hosting account via SSH.

  2. Navigate to your Magento installation directory:

    Bash
    
    cd ~/public_html
    
  3. Open the index.php file in a text editor.

  4. Add the following lines after the $maintenanceFile = 'maintenance.flag'; line:

    $ip = $_SERVER['REMOTE_ADDR'];
    $allowed = array('xxx.xxx.xxx.xxx'); // Replace with your IP
    

    (To allow multiple IPs, separate them with commas.)

  5. Modify the conditional statement:

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

     

  6. Save changes and exit the editor.

  7. Enable maintenance mode:

    Bash
    
    touch maintenance.flag
    
  8. Disable maintenance mode:

    Bash
    
    rm maintenance.flag
    
 

Important Notes

  • Always back up your site before performing updates.

  • Authorized IPs allow developers/admins to continue working while customers see the maintenance page.

  • Maintenance mode is essential when applying patches, upgrading Magento, or installing new extensions.

Bu cavab sizə kömək etdi? 0 istifadəçi bunu faydalı hesab edir (0 səs)

Powered by WHMCompleteSolution