2012-06-01 94 views
0

我們正在運行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之間共享託管。

希望你能幫助我們並對我的英語感到抱歉。

謝謝您的幫助 昆汀

回答

0

您是否嘗試過尋找Magento管理配置頁面?轉到System -> Configuration -> Web,然後將Configuration Scope更改爲store2網站的等效項。展開Unsecure部分並在基本URL字段中輸入http://www.store2.com。如果您打算使用SSL並使用https://www.store2.com/,請對安全部分執行相同操作。

System->Configuration->Web section Magento Admin

同時請注意,您不能使用{{BASE_URL}}上了Magento的1.6.x上

1

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所以它可以幫助,但你需要更新你的虛擬主機設置,它可能不會在某些情況下,合適的解決方案。