Greetings Tell me, how can I redirect mobile traffic based on mobile OS? For example, for iOS (ipad and iphone) send to one page, android to another, and for example symbian and the rest to third. And accordingly windows nt send to the main version of the site. Is it better to define user-agent and redirect via htaccess or java?

    2 answers 2

    Try using htaccess

    RewriteCond %{HTTP_USER_AGENT} (?i:iphone|ipad) RewriteRule ^(/)?$ http://site/ios/ [R=301] RewriteCond %{HTTP_USER_AGENT} (?i:android) RewriteRule ^(/)?$ http://site/android/ [R=301] RewriteCond %{HTTP_USER_AGENT} (?i:symbian) RewriteRule ^(/)?$ http://site/symbian/ [R=301] 

      Can be done via .htaccess, php or javascript . I would prefer php.

      • As zadolbavshiysya on the tablet from fans to redirect to useless-scanty versions of pages, I can not speak. The JS option takes into account the possibility of setting a cookie on a mobile device to look at the normal version of the site (part about document.cookie.indexOf("iphone_redirect=false") == -1 ). PHP version, as it is there - no. When making a redirect, be sure to remember this. - drdaeman 2:42 pm