I have a requirement where I have to redirect based on the mobile device type. I am using
RewriteCond %{REQUEST_URI} !^/mobile
RewriteCond %{HTTP_USER_AGENT} "BlackBerry|Opera|Palm|Symbian|iPhone|iPod" [NC]
RewriteCond %{REQUEST_URI} ^/homepage/login
RewriteRule .? [
%{HTTP_HOST}%1...] [R=301,L]
For Android though I have to redirect only if it's a mobile and not tablet. So I have
RewriteCond %{REQUEST_URI} !^/mobile
RewriteCond %{HTTP_USER_AGENT} "Android" [NC]
RewriteCond %{HTTP_USER_AGENT} "Mobile" [NC]
RewriteCond %{REQUEST_URI} ^/homepage/login
RewriteRule .? [
%{HTTP_HOST}%1...] [R=301,L]
Right now I have these 2 conditions separated and they work like a charm. However, I am trying to figure it out how can I combine them and make the rewrite conditions cleaner, and faster from performance standpoint.
Any help in optimizing this is appreciated.