This question has already been answered:

There is the main site domen.ru, its mobile version on m.domen.ru and another site on the subdomain xxx.domen.ru. When handling mob. the device to the site domen.ru is redirected to the mobile version of m.domen.ru.

Problem: You cannot download the site xxx.domen.ru from a mobile device (not a mobile version), because Immediately goes to the redirect to the mob. version m.domen.ru

.Htaccess file:

Options +FollowSymlinks AddDefaultCharset Off <IfModule mod_php4.c> php_flag magic_quotes_gpc off php_flag magic_quotes_runtime off php_flag register_globals off </IfModule> <IfModule mod_php5.c> php_flag magic_quotes_gpc off php_flag magic_quotes_runtime off php_flag register_globals off </IfModule> <IfModule mod_dir.c> DirectoryIndex index.php index.htm index.html </IfModule> <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www.domen\.ru$ [NC] RewriteRule ^(.*)$ http://domen.ru/$1 [R=301,L] RewriteCond %{THE_REQUEST} ^[AZ]{3,9}\ /index\.php\ HTTP/ RewriteRule ^index\.php$ http://domen.ru/ [R=301,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php </IfModule> RewriteCond %{HTTP:x-wap-profile} !^$ [OR] RewriteCond %{HTTP:Profile} !^$ [OR] RewriteCond %{HTTP_USER_AGENT} "acs|alav|alca|amoi|audi|aste|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "dang|doco|eric|hipt|inno|ipaq|java|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|opwv" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "palm|pana|pant|pdxg|phil|play|pluc|port|prox|qtek|qwap|sage|sams|sany" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|w3cs|wap-|wapa|wapi" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "wapp|wapr|webc|winw|winw|xda|xda-" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "up.browser|up.link|windowssce|iemobile|mini|mmp" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "symbian|midp|wap|phone|pocket|mobile|pda|psp" [NC] RewriteCond %{HTTP_USER_AGENT} !macintosh [NC] # Check if we're not already on the mobile site RewriteCond %{HTTP_HOST} !^m\. # Can not read and write cookie in same request, must duplicate condition RewriteCond %{QUERY_STRING} !(^|&)m=0(&|$) # Check to make sure we haven't set the cookie before RewriteCond %{HTTP_COOKIE} !^.*mredir=0.*$ [NC] # Now redirect to the mobile site RewriteRule ^ http://m.domen.ru%{REQUEST_URI} [R,L] 

Options +FollowSymlinks AddDefaultCharset Off <IfModule mod_php4.c> php_flag magic_quotes_gpc off php_flag magic_quotes_runtime off php_flag register_globals off </IfModule> <IfModule mod_php5.c> php_flag magic_quotes_gpc off php_flag magic_quotes_runtime off php_flag register_globals off </IfModule> <IfModule mod_dir.c> DirectoryIndex index.php index.htm index.html </IfModule> <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www.domen\.ru$ [NC] RewriteRule ^(.*)$ http://domen.ru/$1 [R=301,L] RewriteCond %{THE_REQUEST} ^[AZ]{3,9}\ /index\.php\ HTTP/ RewriteRule ^index\.php$ http://domen.ru/ [R=301,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php </IfModule> RewriteCond %{HTTP:x-wap-profile} !^$ [OR] RewriteCond %{HTTP:Profile} !^$ [OR] RewriteCond %{HTTP_USER_AGENT} "acs|alav|alca|amoi|audi|aste|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "dang|doco|eric|hipt|inno|ipaq|java|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|opwv" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "palm|pana|pant|pdxg|phil|play|pluc|port|prox|qtek|qwap|sage|sams|sany" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|w3cs|wap-|wapa|wapi" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "wapp|wapr|webc|winw|winw|xda|xda-" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "up.browser|up.link|windowssce|iemobile|mini|mmp" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "symbian|midp|wap|phone|pocket|mobile|pda|psp" [NC] RewriteCond %{HTTP_USER_AGENT} !macintosh [NC] # Check if we're not already on the mobile site RewriteCond %{HTTP_HOST} !^m\. # Can not read and write cookie in same request, must duplicate condition RewriteCond %{QUERY_STRING} !(^|&)m=0(&|$) # Check to make sure we haven't set the cookie before RewriteCond %{HTTP_COOKIE} !^.*mredir=0.*$ [NC] # Now redirect to the mobile site RewriteRule ^ http://m.domen.ru%{REQUEST_URI} [R,L]

Reported as a duplicate by Visman members, Nicolas Chabanovsky Oct 21 '16 at 10:57 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

  • This question should be closed, because it is a duplicate of the question. Stackoverflow.com/questions/578141/… - Visman
  • The issue was not resolved, so I had to create a new one with a more complete formulation. - designer
  • @designer Please use the edit link located under the question marks to add / clarify a question. A new question should be asked if you have a new problem / task. - Nicolas Chabanovsky
  • @designer, immediately following the RewriteCond %{HTTP_HOST} !^m\. RewriteCond %{HTTP_HOST} !^xxx\. - Visman

1 answer 1

Namay look the right option to put the option "show the full version of the site" in the settings of a mobile browser. I don't remember exactly how it sounds. In the Yandex browser, there is an option "show the full version of the site." Then, the browser itself will send the “desktop” counterpart user-agent and htaccess will not send it to m.domain.ru

Either edit .htaccess, comment out all the lines after </IfModule> , to the end of the file.

#RewriteCond %{HTTP:x-wap-profile} !^$ [OR] #RewriteCond %{HTTP:Profile} !^$ [OR] #RewriteCond %{HTTP_USER_AGENT} ... and so on. In the future, just remove the comment.

You can also use mobile browser emulation on a PC using developer tools. Look, for example, " my_browser mobile device emulation".

  • Skit, thanks for the reply. - designer
  • But, we cannot offer all users of the site to make such settings in the browser. We need the mobile version anyway, otherwise the meaning of its creation disappears. Can I set up an exception for xxx.domen.ru in .htaccess so that it does not redirect to m.domain.ru? - designer
  • Of course, this can be done! Unfortunately, I have little experience with this, I can not immediately say. - Skit