How can I detect the version of Android devices in an htaccess file? Something like this:
RewriteCond %{REQUEST_URI} !^/directory_for_android_1_x/.*$
RewriteCond %{HTTP_USER_AGENT} "android1.x" [NC]
RewriteRule ^(.*)$ /directory_for_android_1_x/ [L,R=302]
I need to hit 1.x, 2.x, 3.x and 4.x.
You can’t, not with any sort of reliability – user agent sniffing is complicated and fraught with peril, and if you’re doing it all it shouldn’t be via
.htaccess.You’ll be a lot better off using something like Modernizr to detect supported features and CSS @media queries to and adjust your site’s behaviour accordingly.