Skip to content

Instantly share code, notes, and snippets.

@ravixp
Last active July 12, 2017 18:02
Show Gist options
  • Select an option

  • Save ravixp/25f441fed08e424505f220010fd79e77 to your computer and use it in GitHub Desktop.

Select an option

Save ravixp/25f441fed08e424505f220010fd79e77 to your computer and use it in GitHub Desktop.
Magento 1 : Skip Maintenance Flag with IP address filters
/* Start - Add these to index.php */
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
$allowed = array('188.39.236.202','127.0.0.1');
/* End - Add these to index.php */
/* Modify the maintenance file */
//if (file_exists($maintenanceFile)) {
if (file_exists($maintenanceFile) && !in_array($ip, $allowed)) {
include_once dirname(__FILE__) . '/errors/503.php';
exit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment