Gentlemen, can you give me a hint? Here is a redirect to the mobile version of the site. I found a list of user agents on the web:
midp|samsung|docomo|wireless|nokia|novarra|palmsource|phone|NEC|cdm|palmos|upb|opwv|iphone|mot|blackberry|mib|symbian|chtlhand|mobi|pda|dddi|mmp|audio|nokia|SEC|HTC|j2me|avant|samsung|gradi|pg|mitsu|SIE|alcatel|eric|sch|rover|bird|sagem|sony|pocket|wap|lg|benq|vx|xx|philips|sgh|jb|mmm|panasonic|amoi|sharp|pt|vox|compal|java|kg|voda|sany|dbt|sendo|moto|kdd|androidInterested in how this works. I see 2 letter user agents in this list such as xx, vx, pt, pg, kg
Nothing unnecessary will redirect to the mobile version? Do I understand correctly, when any word in the user agent is found with 2 such letters in a row, it will redirect?
I have visited the site from different desktop browsers, everything seems to be fine, it doesn't redirect.
P.S. I know that in 2022 we should do adaptive, the question is about something else.
In the case you described, I recommend using ready-made library (http://mobiledetect.net/).
The library is a PHP class, fairly easy to detect and do the right thing for smartphones, tablets, and similar surfing method devices. Tested, everything works fine.
I also use this library in mine.
How to connect the library, quite detailed on overcoder (https://overcoder.net/q/1664614/%D0%BA%D0%B0%D0%BA-%D0%BE%D0%BF%D1%80%D0%B5%D0%B4%D0%B5%D0%BB%D0%B8%D1%82%D1%8C-%D1%8F%D0%B2%D0%BB%D1%8F%D0%B5%D1%82%D1%81%D1%8F-%D0%BB%D0%B8-%D1%83%D1%81%D1%82%D1%80%D0%BE%D0%B9%D1%81%D1%82%D0%B2%D0%BE-%D0%BC%D0%BE%D0%B1%D0%B8%D0%BB%D1%8C%D0%BD%D1%8B%D0%BC-%D0%B8%D0%BB%D0%B8-%D0%BD%D0%B0%D1%81%D1%82%D0%BE%D0%BB%D1%8C%D0%BD%D1%8B%D0%BC) and haizdesign (https://haizdesign.com/website-advice/redirect-your-website-to-a-mobile-version/).
No complaints, remarks and stuff like that, I recommend it. :)
Mobile redirects work as follows. A webmaster, for instance, joins an affiliate network and places a code on the site pages that is triggered only when accessing website from a mobile device and redirects the user to a site with malware. For each transition, the webmaster is promised to charge money.
The user gets to a malicious site, and he is redirected to a page with an offer to install some program.
For example, update the Opera Mini mobile browser. To download the update, the site requires the user to send an SMS for several tens of rubles, despite the fact that the mobile browser is distributed for free at all. If the user pays and installs the "updated" program, such SMS messages will continue to be sent automatically, without the consent of the phone owner.
Depending on the browser through which the user came, web sites offer to download files with different extensions. For example, an apk file for Android devices, a jar file for the J2ME platform.
In addition, some sites redirect iPhone, iPod and iPad users to the installation page of a special expensive ipa application - website can supposedly be viewed only with it. But in fact, any browser is suitable for viewing, and the site itself does not contain any useful information.