【问题标题】:Magento 1.9.x Multi site configurationMagento 1.9.x 多站点配置
【发布时间】:2017-03-15 09:56:22
【问题描述】:

我计划使用子域创建 Magento 1.9.x 多站点配置,但我找不到好的解决方案。我已经按照(https://www.properhost.com/ 和 Magento 支持论坛)中提到的所有步骤,但没有找到任何简单而好的解决方案,或者我无法理解。您能否建议我任何指南,该指南将非常清楚地创建具有子域的 DNS 配置的多站点?

就我而言。我已经部署了http://m1.psoft.co.in (magento 基本域)ap.psoft.co.in(安得拉邦的子域,拥有 Nellore Gudur 和 Ongole 商店)和 tn.psoft.co.in(泰米尔南杜的域,包括钦奈和普杜切里)。如果您需要更多详细信息,请告诉我。

【问题讨论】:

    标签: magento magento-1.9


    【解决方案1】:

    您是否为新网站添加了包含 index.php 和 .htaccess 的子文件夹?

    例如: index.php(这个是magento根索引) ... tn/(网站索引的子文件夹) index.php(这个索引文件应该指向 tn 网站域) .htaccess

    tn/index.php 文件应该包含如下内容:

    <?php
    /**
     * Magento
     *
     * NOTICE OF LICENSE
     *
     * This source file is subject to the Open Software License (OSL 3.0)
     * that is bundled with this package in the file LICENSE.txt.
     * It is also available through the world-wide-web at this URL:
     * http://opensource.org/licenses/osl-3.0.php
     * If you did not receive a copy of the license and are unable to
     * obtain it through the world-wide-web, please send an email
     * to license@magento.com so we can send you a copy immediately.
     *
     * DISCLAIMER
     *
     * Do not edit or add to this file if you wish to upgrade Magento to newer
     * versions in the future. If you wish to customize Magento for your
     * needs please refer to http://www.magento.com for more information.
     *
     * @category    Mage
     * @package     Mage
     * @copyright  Copyright (c) 2006-2017 X.commerce, Inc. and affiliates (http://www.magento.com)
     * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
     */
    if (version_compare(phpversion(), '5.2.0', '<')===true) {
            echo  '<div style="font:12px/1.35em arial, helvetica, sans-serif;"><div style="margin:0 0 25px 0; border-bottom:1px solid #ccc;"><h3 style="margin:0; font-size:1.7em; font-weight:normal; text-transform:none; text-align:left; color:#2f2f2f;">Whoops, it looks like you have an invalid PHP version.</h3></div><p>Magento supports PHP 5.2.0 or newer. <a href="http://www.magentocommerce.com/install" target="">Find out</a> how to install</a> Magento using PHP-CGI as a work-around.</p></div>';
            exit;
        }
    
        require '../app/bootstrap.php'; // added ../ here because of subfolder
    
        /**
         * Compilation includes configuration file
         */
        $compilerConfig = 'includes/config.php';
        if (file_exists($compilerConfig)) {
            include $compilerConfig;
        }
    
        $mageFilename = '../app/Mage.php'; // added ../ here because of subfolder
    
        if (!file_exists($mageFilename)) {
            if (is_dir('downloader')) {
                header("Location: downloader");
            } else {
                echo $mageFilename." was not found";
            }
            exit;
        }
    
        require_once $mageFilename;
    
        #Varien_Profiler::enable();
    
        if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
            Mage::setIsDeveloperMode(true);
        }
    
        #ini_set('display_errors', 1);
    
        umask(0);
    
        $mageRunCode = 'tn1'; // your website code
        $mageRunType = 'website'; // runType is website
    
        Mage::run($mageRunCode, $mageRunType);
    

    您可以查看此链接了解更多详情: https://www.crucialhosting.com/knowledgebase/setup-multiple-magento-stores

    或者您可以使用第二种方法无需创建子目录

    第 1 步:将所有域指向 Magento 根目录,即网络服务器(Apache 或 Nginx)配置中的相同文档根目录。

    第 2 步:在 Magento 管理面板的系统配置中将域名配置为每个网站的基本 URL。

    第 3 步:将每个域的商店或网站设置为 .htaccess 或网络服务器配置中的环境变量。

    • 问题中给出的网站示例: SetEnv MAGE_RUN_TYPE website SetEnvIf Host abc.com MAGE_RUN_CODE=domain1 SetEnvIf Host tn.com MAGE_RUN_CODE=domain2
    • 以商店视图而不是网站为例 SetEnv MAGE_RUN_TYPE store SetEnvIf Host abc.com MAGE_RUN_CODE=store_code_1 SetEnvIf Host tn.com MAGE_RUN_CODE=store_code_2

    这些配置检查域是否包含“abc.com”或“xyz.com”,我发现这对于匹配子域或测试系统(如 abc.com.testserver.com 或 test.abc.com)也很有用,使用相同的 .htaccess 文件。如果要精确匹配,请将 abc.com 替换为 ^abc.com$

    第 4 步:清除缓存并访问您的域。

    看到这个答案:https://magento.stackexchange.com/questions/32439/magento-1-9-multiple-websites-on-different-domains

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-03-20
      • 1970-01-01
      • 2019-02-06
      • 1970-01-01
      • 1970-01-01
      • 2015-07-04
      • 1970-01-01
      相关资源
      最近更新 更多