It is necessary to make the redirection to the mobile version of the site located at site.com/m, but at the same time, if it comes to site.com/full, it should be independent of redirecting to site.com/ Found such a solution
set $mobile_request false; if ($http_user_agent ~* "(windows\smobile|windows\sce|iphone|ipod|midp|symbian|series\s60|s60|nokia|аndroid| blackberry|Android)"){ set $mobile_request true; } rewrite ^(/full)(.*)$ \#$2 permanent; if ($mobile_request = true) { return 301 /m$request_uri; } but here if you log in from your phone, it does not redirect to site.com. Tell me some solution.