I am using certain redirection rules in httpd.conf and they work like a charm. However, I am not very content with the way it is. I am certain that there must be efficient and better ways to do this.
Therefore, I would like to know how I could improve the following piece of code for better performance. I want to avoid repetition (something like or condition maybe helpful)
RewriteCond %{HTTP_USER_AGENT} "iPad" [NC]
RewriteCond %{REQUEST_URI} ^/blogs/([0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})$
RewriteCond %{QUERY_STRING} ^lang=en_us
RewriteCond %{REQUEST_URI} ^/blogs/+(.*)$
RewriteRule .? [
%{HTTP_HOST}...] [R=301,L]
RewriteCond %{HTTP_USER_AGENT} "iPad" [NC]
RewriteCond %{REQUEST_URI} ^/blogs/([0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})$
RewriteCond %{QUERY_STRING} ^lang=en_us
RewriteCond %{REQUEST_URI} ^/blogs/+(.*)$
RewriteRule .? [
%{HTTP_HOST}...] [R=301,L]
RewriteCond %{HTTP_USER_AGENT} "iPad" [NC]
RewriteCond %{REQUEST_URI} ^/blogs/([A-W0-9a-f]{13}_([0-9a-f]{4}_){2}[0-9a-f]{12})$
RewriteCond %{QUERY_STRING} ^lang=en_us
RewriteCond %{REQUEST_URI} ^/blogs/+(.*)$
RewriteRule .? [
%{HTTP_HOST}...] [R=301,L]
RewriteCond %{HTTP_USER_AGENT} "iPad" [NC]
RewriteCond %{REQUEST_URI} ^/blogs/([A-W0-9a-f]{13}_([0-9a-f]{4}_){2}[0-9a-f]{12})$
RewriteCond %{QUERY_STRING} ^lang=en_us
RewriteCond %{REQUEST_URI} ^/blogs/+(.*)$
RewriteRule .? [
%{HTTP_HOST}...] [R=301,L]
RewriteCond %{HTTP_USER_AGENT} "iPad" [NC]
RewriteCond %{REQUEST_URI} ^/forums/html/topic
RewriteCond %{QUERY_STRING} ^id=([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$
RewriteRule .? [
%{HTTP_HOST}...] [R=301,L]
--------------------------------------------------------------------
This is another snippet of the code I would like to improve
RewriteCond %{REQUEST_URI} !^/mobile
RewriteCond %{HTTP_USER_AGENT} "BlackBerry|Opera|Palm|Symbian|Android|iPhone|iPod" [NC]
RewriteCond %{REQUEST_URI} ^/homepage/login
RewriteRule .? [
%{HTTP_HOST}%1...] [R=301,L]