Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Magento multistore中同时使用子域和子目录?_Magento_Subdomain_Subdirectory_Multistore - Fatal编程技术网

在Magento multistore中同时使用子域和子目录?

在Magento multistore中同时使用子域和子目录?,magento,subdomain,subdirectory,multistore,Magento,Subdomain,Subdirectory,Multistore,我目前在Magento有一个商店,有几种不同语言的商店视图,如example.com/sv/、example.com/fi/等。现在我想在子域中添加一个商店,如test.example.com,但我无法使其正常工作 我为子域添加了一个新的存储和一个新的存储视图,然后更改了该子域的基本URL。我已经创建了子域,它指向magento安装的位置。我还在.htaccess文件中添加了不同的行,尝试了下面的一些变体 SetEnvIf Host .*newstore.* MAGE_RUN_CODE=news

我目前在Magento有一个商店,有几种不同语言的商店视图,如example.com/sv/、example.com/fi/等。现在我想在子域中添加一个商店,如test.example.com,但我无法使其正常工作

我为子域添加了一个新的存储和一个新的存储视图,然后更改了该子域的基本URL。我已经创建了子域,它指向magento安装的位置。我还在.htaccess文件中添加了不同的行,尝试了下面的一些变体

SetEnvIf Host .*newstore.* MAGE_RUN_CODE=newstore
SetEnvIf Host .*newstore.* MAGE_RUN_TYPE=website

RewriteCond %{HTTP_HOST} .*newstore\.com [NC]
RewriteRule .* - [E=MAGE_RUN_CODE:newstore]
RewriteCond %{HTTP_HOST} .*newstore\.com [NC]
RewriteRule .* - [E=MAGE_RUN_TYPE:website]
但什么都不管用。当我尝试访问子域时,我会被重定向到主存储。但我可以作为子目录访问新的存储,它应该像test.example.com一样,但我必须编写example.com/test

我想做的事情可能吗

更新15-04-09


我在.htaccess文件中发现了一个重定向,导致子域重定向到主存储。我删除了它,现在我可以访问子域,但页面只是白色的,上面写着“Index of/”等。因此我没有获得magento商店视图。

我在.htaccess中使用此代码,它可以满足您的需要:

SetEnvIfNoCase Host "^it\.mystore\.com$"    MAGE_RUN_TYPE=website MAGE_RUN_CODE=ws_it
SetEnvIfNoCase Host "^pt\.mystore\.com$"    MAGE_RUN_TYPE=website MAGE_RUN_CODE=ws_pt

SetEnvIfNoCase Host "^fr\.mystore\.be$" MAGE_RUN_TYPE=store MAGE_RUN_CODE=fr_be
SetEnvIfNoCase Host "^nl\.mystore\.be$" MAGE_RUN_TYPE=store MAGE_RUN_CODE=nl_be

另外,请确保您已在系统>配置>常规Web>新网站或商店的安全和不安全设置中正确定义了基本URL(在您的示例中:test.example.com)

我已经尝试过了,但仍然不起作用。我发现一个重定向导致了一些问题,所以现在我只得到一个白色页面,上面写着“Index of/”等等。我仍然没有得到新的商店视图。你看到Index.php、cron.php了吗。。。在下面的“索引”列表中?不,我没有。页面上未列出任何文件。子域指向与主域相同的IP。我想可能是服务器上的设置问题。我有一个文件夹“www”,其中包含两个文件夹“html”和“www.test.com”。“html”文件夹中只有一个.htaccess文件,而另一个文件夹中还有一个名为“html”的文件夹,其中包含Magento安装。也许我只访问了第一个“html”文件夹?您可能需要在apache中配置一些东西(查找httpd.conf或httpd vhosts.conf),以便将新子域指向正确的Magento安装文件夹。回答你的最后一个问题,我想是的。