0
votes

I am building a virtual store with Magento, and I am using the HostGator hosting with the "M" plan, that have support for more than one site, the problem is that Magento is in the root and I have another site inside the folder /example.com.br, but when I try to access this site via browser:

http://example.com.br

I am redirected to the Magento site:

http://magentosite.com.br/maintenance.html

The htaccess that are on root folder (htaccess of magento) is redirecting to the magento maintenance page http://magentosite.com.br/maintenance.html, and I need to stay only Magento in maintenance and not the sites that are within certain folders like folder /example.com.br, /example2.com.br and etc...

This is the maintenance code I'm using in Magento (that are in Root):

RewriteEngine On
RewriteBase /
# allow my ip to access magento store
RewriteCond %{REMOTE_ADDR} !^177\.18\.228\.58
RewriteCond %{REQUEST_URI} !^/maintenance\.html$
RewriteRule ^(.*)$ https://magentosite.com.br/maintenance.html [R=307,L]

I tryed this solution https://stackoverflow.com/a/6528448/2761794 but doesn't worked for me...

1

1 Answers

0
votes

I used Magento's maintenance mode, and instead of using the "maintenance.flag" file, I created my custom file and redirected it, so I did not have to change the htaccess file, so the other sites in the subfolder worked normally.

I add this code to index.php of Magento root:

$maintenanceFile = 'maintenance.html';
$ip = $_SERVER['REMOTE_ADDR'];
$allowed = array('177.99.108.78', 'another ip...');

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