We have just created a mobile friendly version of our site. Though I am still working to finesse it, the site looks fine on my blackberry.
Is there a way using .htaccess or something to automatically redirect iphone, blackberry users et. al to the mobile version?
Thank you
P.s. is there such thin as css for the mobile version?
You can definitely redirect mobile users via htaccess. Here’s an example:
RewriteCond %{HTTP_USER_AGENT} ^.*iPhone.*$
RewriteRule ^(.*)$ http://mobile.yourdomain.com [R=301]
RewriteCond %{HTTP_USER_AGENT} ^.*BlackBerry.*$
RewriteRule ^(.*)$ http://mobile.yourdomain.com [R=301]
RewriteCond %{HTTP_USER_AGENT} ^.*Palm.*$
RewriteRule ^(.*)$ http://mobile.yourdomain.com [R=301]I grabbed the code from this article.
At Devot:ee there’s a plugin called MX Mobile Device Detect that I use to send visitors to the mobile version of my site.
There are wildcards but I’ll defer you over to Apache’s docs as you’ll probably have more questions.
Awesome find, ak4mc. This definitely appears to be the easiest way to go.
Okay ….
so….
I have upload the plugin into the correct folder my next questions are…
where do I put these plugs on the template? where it says site.com do I redirect it to site.com/mobile/new tempalte?
{exp:mobile_detect location="http://m.site.com/"}
{exp:mobile_detect location="http://site.com/" redirect="not_mobile"}
{exp:mobile_detect} {if mobile} Is mobile device {/if} {if not_mobile} Is not mobile device {/if} {/exp:mobile_detect}
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.