我有多域magento网站。就像桌面的www.domain.com和移动设备的m.domain.com一样。
我使用以下代码来检测移动设备并重定向to m.domain.com, which is working fine
,但是当需要使用http://www.domain.com/?___store=default it goes in redirect loop. how to fix it
等链接访问www.domain.com时
你的帮助表示赞赏。
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 :(得分: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]
答案 1 :(得分:0)
解决方案, 当您单击移动站点链接转到普通版本时,添加浏览器cookie。
您可以查看Cookie的可用性并重定向。