2014-07-26 133 views
1

我有多域magento網站。像www.domain.com for desktop和m.domain.com for mobile一樣。Magento手機網站全站點重定向

我用下面的代碼來檢測移動設備和重定向to m.domain.com, which is working fine,但是當需要來www.domain.com與鏈接像http://www.domain.com/?___store=defaultit goes in redirect loop. how to fix it

您的幫助appreciate.`

RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC] 
RewriteCond %{QUERY_STRING} !___store=default [NC] 
RewriteCond %{HTTP_COOKIE} !track=default [NC] 
RewriteRule (.*) http://m.domain.com/$1 [L,R=301] [E=MAGE_RUN_CODE:mobile] 

RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC] 
RewriteCond %{QUERY_STRING} ___store=default [NC]  
RewriteRule (.*) http://www.domain.com/ [L,R=301] [E=MAGE_RUN_CODE:base,CO=track:default:%{HTTP_HOST}] 

RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC] 
RewriteCond %{QUERY_STRING} !___store=mobileview [NC] 
RewriteCond %{HTTP_COOKIE} track=default [NC] 
RewriteRule (.*) http://www.domain.com/ [L,R=301] [E=MAGE_RUN_CODE:base] 

RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC] 
RewriteCond %{QUERY_STRING} ___store=mobileview [NC]  
RewriteRule (.*) http://m.domain.com/$1 [E=MAGE_RUN_CODE:mobile,CO=track:mobile:%{HTTP_HOST}]` 

回答

0

詹妮弗,請嘗試以下

RewriteCond %{HTTP_HOST} ^www\.domain\.com [NC] 
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC] 
RewriteRule ^(.*)$ http://m.domain.com/$1 [L,R] 
+0

感謝回答,但你發送重定向是桌面網站,移動網站,這已經是做工精細,我想從手機,它出現在環 – Jennifer

0

解決方案, 當你點擊移動網站鏈接跳轉,也沒有mal版本添加瀏覽器cookie。

的,你可以檢查Cookie的可用性和重定向。

+0

尼爾感謝您的答覆回來桌面站點。你可以給它語法嗎? – Jennifer