Redirect depending on User Agent means Apache

Hello,

tell me, please, is it possible in the config of the virtual host to check for a user agent words iphone, ipod, ipad and, if so, to throw it to another domain?
October 14th 19 at 12:31
3 answers
October 14th 19 at 12:33
Solution
Opens the documentation for mod_rewrite and a little change is one example:

RewriteCond %{HTTP_USER_AGENT} iphone|ipod|ipad
RewriteRule ^/(.*) http://iphone.mysite.ru/$1 [L]
Thank you very much. I didn't think that just because all... - Maurine_Jacobi commented on October 14th 19 at 12:36
Your option has not earned that earned that that below.
I understand the regular season where it doesn't work, you will need a fresh mind tomorrow to test in more detail. - Maurine_Jacobi commented on October 14th 19 at 12:39
Yes, it works, but you need to add the nocase flag, that is, the first line should be:
RewriteCond %{HTTP_USER_AGENT} iphone|ipod|ipad [NC] - Maurine_Jacobi commented on October 14th 19 at 12:42
October 14th 19 at 12:35
Can. View the documentation for mod_rewite
October 14th 19 at 12:37
In .htaccess:
RewriteEngine On 
RewriteCond %{HTTP_USER_AGENT} Mobile.+Safari
RewriteRule ^ http://habrahabr.ru [R,L] 

Find more questions by tags iPhoneApache