How to redirect using htaccess when mobile user acces on my jpg,bmp,gif files on my site
example : i want to redirect mysite.com/media/upload/files.jpg|jpeg|bmp|gif|png into m.mysite.com/media/upload/files.jpg|jpeg|bmp|gif|png
Here is my htaccess
RewriteEngine On
RewriteRule \.(jpg|png|gif|jpeg|bmp)$ - [L]
RewriteCond %{HTTP_USER_AGENT} (mobile|android|blackberry|brew|cldc|docomo|htc|j2me|micromax|lg|midp|mot|motorola|netfront|nokia|obigo|openweb|opera.mini|palm|psp|samsung|sanyo|sch|sonyericsson|symbian|symbos|teleca|up.browser|vodafone|wap|webos|windows.ce) [NC]
RewriteRule ^(.*)$ m.mysite.com [R=302,L]
the problems is, when mobile user straight accessing http:// mysite.com/media/upload/files.jpg it still not redirect into m.mysite.com/media/upload/files.jpg
Assuming that you're checking against the correct user agents, try: