I found a simple .htaccess solution that drives all mobile devices from mysite.com to m.mysite.com. What I like about this code is that it works great at
www.mobilephoneemulator.com/
The problem is the "View Main Website" link on the mobile menu does not work. It loops back to the mobile site.
Site:
bluemooncafe.us (mobile site
m.bluemooncafe.us).
Any solutions or suggestions? Or is an .htacess solution just not possible for this configuration?
######################################################################################## This .htaccess file redirects mobile browsers and devices to an alternate destination## Authors: vijay kumar Onlinetraffic.ie# onlineraffic.ie# Copyright 2012, onlinetraffic########################################################################################
# Ensure rewriting is onRewriteEngine On
# Check for redirect paramRewriteCond %{QUERY_STRING} ^.*redirect=true.*RewriteRule ^(.*)$ - [co=gomobi_prevent_redirect:false:.www.bluemooncafe.us:0:/]
RewriteCond %{QUERY_STRING} ^.*redirect=false.*RewriteRule ^(.*)$ - [co=gomobi_prevent_redirect:true:.www.bluemooncafe.us:7200:/]
RewriteCond %{HTTP_COOKIE} !gomobi_prevent_redirect=true [OR]RewriteCond %{QUERY_STRING} ^.*redirect=true.*
# Don't redirect if its falseRewriteCond %{QUERY_STRING} !^.*redirect=false.*
# Exclude certain paths e.g. cpanel admin etc.RewriteCond %{REQUEST_URI} !(.*)cpanel(/?)$
# Switch based on significant accept headersRewriteCond %{HTTP_ACCEPT} "text/vnd.wap.wml|application/vnd.wap.xhtml+xml" [NC,OR]
# Specific devices/mandufacturersRewriteCond %{HTTP_USER_AGENT} "iphone|ipad|ipod|android|nokia|ios|opera m(ob|in)i|iemobile|symbian|samsung|sec-|htc|huawei|ericsson|sonyericsson|blackberry|motorola|sagem|kyocera|zte|kddi|docomo|j-phone|kwc|lenovo|lg|mot|softbank|nec|audiovox|alcatel|sharp|sie-|sanyo|sendo|amoi|xda|bird|benq|palm|pantech|panasonic|fly|asus-|baiduispider|googlebot-mobile|nintendo|psp|dalvik|windows ce|foma|brew|webos|fennec|netfront|teleca|obigo|vodafone|up.browser|portalmmm" [NC]
RewriteRule ^(.*)$
m.bluemooncafe.us [L,R=302]"