Desktop and mobile version of the website. How to do everything?

Hey all, working on the project, which will be 2 versions - mobile and full. Mobile will be the subdomain m. Please do not talk about the pros and cons of this approach and to compare with the responsive layout. Decided to do it on the subdomain.
Question: how best to identify the device when you first log on? On nginx, did you define the headings, for example, if the title has android or ios, then a mobile phone. Who than uses?
And the second question: if the redirect on nginx to do, how to do the "memorization", for example, a person was sent on my mobile And it tablet. In this case, he can independently go to the full and it is necessary to remember.
I will be glad to councils. Thank you.
July 12th 19 at 16:58

Find more questions by tags PHP