Magento Multistore:将非www重定向到www
我们正在运行Magento CE 1.6.2,并且我们想要运行另一个商店。我们已经正确配置了store2.com,但是我们遇到了问题:Magento Multistore:将非www重定向到www
store1.com重定向到www.store1.com:好吧 store2.com和www.store2.com重定向到www.store1.com:不行
这里是我们的.htaccess:
SetEnvIf Host .*store2.com MAGE_RUN_CODE=store2_com
SetEnvIf Host .*store2.com MAGE_RUN_TYPE=website
重定向非WWW到www我们使用:
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
这个配置不起作用。
我们在store2.com上运行一个托管域,并在store1.com和store2.com之间共享托管。
希望你能帮助我们并对我的英语感到抱歉。
谢谢您的帮助 昆汀
您是否尝试过寻找Magento管理配置页面?转到System -> Configuration -> Web
,然后将Configuration Scope
更改为store2
网站的等效项。展开Unsecure
部分并在基本URL字段中输入http://www.store2.com
。如果您打算使用SSL并使用https://www.store2.com/
,请对安全部分执行相同操作。
同时请注意,您不能使用{{BASE_URL}}上了Magento的1.6.x上
1)确保所有域指向Magento的后端相同的文档根
2)指定基本URL为每个商店/网站运行(如果它们是不同的)
3)修改index.php文件选择基于域
在我们的index.php正确的商店/网站,我们有这样的事情
switch($_SERVER['HTTP_HOST']) {
case 'www.example.com':
$mageRunCode = 'www_exampe_com';
break;
case 'another.example.com':
$mageRunCode = 'another_example_com';
break;
case 'admin.example.com':
$mageRunCode = 'admin';
break;
default:
$mageRunCode = 'www_example_com';
}
}
Mage::run($mageRunCode, $mageRunType);
其中www_example_com,another_example_com是系统>商店管理中指定的商店代码。
更新: 另外我发现这个教程http://www.magentocommerce.com/knowledge-base/entry/tutorial-multi-site-multi-domain-setup所以它可以帮助,但你需要更新你的虚拟主机设置,它可能不会在某些情况下,合适的解决方案。