Good evening. There is a site that lies on the main domain site.ru and the mobile version of the site, on m.site.ru

How can you quite easily determine whether the user is sitting on the phone? If he is sitting on the phone, then I just want to transfer it to m.site.ru, with memorization in cookies. What do you advise to do?

    1 answer 1

    RewriteCond %{HTTP_USER_AGENT} (?i:midp|samsung|iphone|android) RewriteRule ^(/)?$ http://m.site.ru/ [R=301] 

    Did so. It remains to add the right agents. Tell me;)

    • 3
      There is such a thing: api.yandex.ru/detector ps We have equal respect) - Alexey Lobanov
    • @ Alexey Lobanov, thanks for the link) An interesting thing. Yes, the rating is the same) Tell me how to take your answer for the correct one?) - Emil Sabitov