0

I would like to have multiple website in my Magento Server. But I need to put only one website under maintanence not the entire server.

http://devdocs.magento.com/guides/v2.2/install-gde/install/cli/install-cli-subcommands-maint.html

The commands in the above link is turning the entire server to maintanence mode. But, I need to turn only a particular website to Maintanence mode and also I should access the REST API's during the maintanence period.

0

I know 2 ways of doing:

1st and easiest, simple create a page you want to display, name it as index.php and replace your file on public_html

2nd, go to your index.php file, and add this code on line 49:

$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
$maintenanceFile = 'maintenance.flag';
$ip = $_SERVER['REMOTE_ADDR'];
$allowed = array('69.65.23.100','2.2.2.2'); //insert your allowed IP here

if (!file_exists($mageFilename)) {
    if (is_dir('downloader')) {
        header("Location: downloader");
    } else {
        echo $mageFilename." was not found";
    }
    exit;
}

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

Remember to always have the backup updated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.