I'd like to have .htaccess code that will redirect users to either a mobile version of my site (320x240 sizing) or a tablet sizing (whatever that turns out to be). In the past year or so, I've been redirecting too many iPad and Galaxy users to the too-small mobile version of my site.
Here is what I have as of now. My site is www. of course and my mobile site is m. Some day, my tablet site will be t.
# Mobile devices - / only
RewriteCond %{REQUEST_URI} !^/m/.*$
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
RewriteCond %{HTTP_USER_AGENT} !".*iPad.*|.*Galaxy.*" [NC]
RewriteCond %{HTTP_USER_AGENT} !macintosh [NC]
RewriteRule ^/$ [
m.mysite.com...] [L,R=301]
# Tablet devices - / only
?
I will handle additional pages and cookie-ing so that people can elect to view my full site later. For now, I just want a clean split between mobile and tablet. I know I need more tablet devices, so I figure I'll gather those over time. Unless - there is some catch-all I can use in .htaccess to differentiate mobile vs. tablets.
Does anyone have a tried and true way to do this reliably?
As a part B. to this question, do some people put JS in their m. site version to split out in the code a mobile sized site and a tablet sized site? I'm thinking about that first RewriteCond above and how it's really just m. or not m. right now, but what will I do if I have a t. version of my site.