Redirect depending on User Agent by means of Apache

Asked by daxson

Hello,

Tell me, please, is there a possibility in the virtual-host config to check if the user agent has the words iphone, ipod, ipad and if so, then transfer it to another domain?

Answers

mishelle rennie
Opens the documentation for mod_rewrite and slightly changes one of the examples:

 
RewriteCond  %{HTTP_USER_AGENT}  iphone|ipod|ipad
RewriteRule  ^/(.*)              http://iphone.mysite.ru/  [L]
Replies:
Thank you very much. I didn’t think that everything was so simple ... - christina riewerts
Your option didn’t work, the one from below was working.
As far as I understand, the regular season somewhere does not work, it will be necessary to test it in more detail tomorrow. - andrew rumbles
Yes, everything works, but you need to add the nocase flag, that is, the first line should be like this:
RewriteCond% {HTTP_USER_AGENT} iphone | ipod | ipad [NC] - mark robinson
lauren deville
You can. See the documentation for mod_rewite
yz the whyz
.htaccess:
 
RewriteEngine On                      
RewriteCond %{HTTP_USER_AGENT} Mobile.+Safari
RewriteRule ^ http://habrahabr.ru [R,L] 
Hibernate custom loader query :: Database Designer, with good visualization and work with the database? :: Advise a good book (books) on the design of software architecture. Beginner-intermediate level :: What are the analogues of OpenX? :: Advise an explanatory book on Java EE 6
Leave Repply for Redirect depending on User Agent by means of Apache
Useful Links