0

私は Magento で仮想ストアを構築しています。複数のサイトをサポートする「M」プラン/example.com.brで HostGator ホスティングを使用しています。問題は、Magento がルートにあり、フォルダー内に別のサイトがあることです。しかし、ブラウザからこのサイトにアクセスしようとすると:

http://example.com.br

Magento サイトにリダイレクトされます。

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

ルート フォルダー (magento の htaccess) にある htaccess は、magento メンテナンス ページhttp://magentosite.com.br/maintenance.htmlにリダイレクトされます。フォルダーなどの特定のフォルダー内にあるサイトではなく、Magento のみをメンテナンスする必要があり/example.com.brます/example2.com.br

これは、Magento (ルートにある) で使用しているメンテナンス コードです。

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]

このソリューションhttps://stackoverflow.com/a/6528448/2761794を試しましたが、うまくいきません...

4

1 に答える 1

0

Magentoのメンテナンスモードを利用し、「maintenance.flag」ファイルを利用する代わりに、カスタムファイルを作成してリダイレクトしたため、htaccessファイルを変更しなくてもよかったので、サブフォルダ内の他のサイトは正常に動作しました。

このコードを Magento ルートの index.php に追加します。

$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;
}
于 2017-01-01T14:28:07.663 に答える