There exists a rails application that is handling demands from both m.host.com and host.com. When the request is available in to m.host.com, the rails application page cache dir is /public/cache/m/, and when the request involves host.com the page cache dir is /public/cache/www/.

However , the very first RewriteCond has been matched up for demands to m.host.com and host.com.

# if the `HTTP_HOST` starts with "m." (m.host.com), look for the cache in /cache/m/...
RewriteCond %{HTTP_HOST} ^m\..*
RewriteRule ^([^.]+)/$ /cache/m/$1.html [QSA]
RewriteRule ^([^.]+)$ /cache/m/$1.html [QSA]

# if not, look for the cache in /cache/www/...
RewriteCond %{HTTP_HOST} !^m\..*
RewriteRule ^([^.]+)/$ /cache/www/$1.html [QSA]
RewriteRule ^([^.]+)$ /cache/www/$1.html [QSA]

Give mtss is a try:

# if the `HTTP_HOST` starts with "m." (m.host.com), look for the cache in /cache/m/...
RewriteCond %{HTTP_HOST} ^m\.
RewriteRule ^([^.]+)/?$ /cache/m/$1.html [L,QSA]

# if not, look for the cache in /cache/www/...
RewriteCond %{HTTP_HOST} !^m\.
RewriteRule ^([^.]+)/?$ /cache/www/$1.html [L,QSA]

With the addition of the 'L' towards the parameters you know the parser the current RewriteRule may be the 4g iphone applied to the present request.

Additionally a RewriteCond only is applicable towards the single next RewriteRule, this is exactly why your rewrites were exactly the same for just about any request, the parser would apply both second RewriteRules towards the request.