对于多站点,我需要两个单独的Magento安装吗? [英] Do I need two separate installations of Magento for multi site?
问题描述
一个多星期以来,我一直在尝试在Magento中设置多站点多域设置.并没有成功!我首先尝试在本地主机上进行操作,然后尝试在实时服务器(共享主机)上进行操作.
I have been trying to setup multi site multi domain setup in Magento for more than a week now. And no success! I first tried to do it on localhost then I tried to do it on live server (shared hosting).
我遵循了本教程 http://www.magentocommerce.com/knowledge-base/entry/tutorial-multi-site-multi-domain-setup ,但没有任何反应.
I followed this tutorial http://www.magentocommerce.com/knowledge-base/entry/tutorial-multi-site-multi-domain-setup but nothing happens.
有人可以回答我的基本问题吗?我需要两个单独的Magento安装来执行多站点多域设置,还是只需要一个具有两个域的安装?我很迷惑.请帮忙!
Can someone answer to my basic question? Do I need two separate Magento installations to perform multi site multi domain setup or only one installation with two domains? I am confused. Please, help!
致谢!
推荐答案
您可以在一个安装中运行多个Magento存储.线索在index.php
中,具体是:
You can run more than one Magento store on a single installation. The clue is in the index.php
, specifically:
/* Store or website code */
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : 'default';
/* Run store or run website */
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';
Mage::run($mageRunCode, $mageRunType);
$mageRunCode
定义了我们正在初始化的商店或网站的代码(在管理"区域的Manage Store
部分中定义). $mageRunType
定义我们将要初始化商店还是网站.
The $mageRunCode
defines the code of the store, or website, (as defined in the Manage Store
section of the Administration area) that we're initialising. The $mageRunType
defines whether we're going to be initialising a store, or a website.
如您所见,Magento首先检查适当的值作为环境变量.以apache为例,这些变量的值需要在httpd.conf
的VirtualHost
部分或类似的位置进行设置.我们使用SetEnv
指令设置环境变量:
As you can see, Magento first checks for appropriate values as environment variables. Using apache as an example, values for these variables will need to be set in the VirtualHost
section of your httpd.conf
, or similar. We set the environment variables using the SetEnv
directive:
SetEnv MAGE_RUN_TYPE website
SetEnv MAGE_RUN_CODE website_code_001
我们可以对所有域使用相同的DocumentRoot
,因为我们允许VirtualHost
根据请求的主机名切换$_SERVER['MAGE_RUN_{CODE,TYPE}']
的值.
We can use the same DocumentRoot
for all of our domains as we're allowing the VirtualHost
to switch the values of $_SERVER['MAGE_RUN_{CODE,TYPE}']
depending on the requested hostname.
这篇关于对于多站点,我需要两个单独的Magento安装吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!