There is a website: domen.ru mob. version: m.domen.ru

The problem is this: a link from the website domen.ru to xxx.domain.ru is always a redirect of m.domen.ru. How to remedy the situation so that you can follow the link to xxx.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] 

    1 answer 1

    You really do not need to catch so many devices to cover most of the mobile devices (you still don’t adapt to each of them):

     RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos" [NC] RewriteCond %{HTTP_HOST} !^m\.domen\.ru [NC] RewriteCond %{QUERY_STRING} !(^|&)m=0(&|$) RewriteCond %{HTTP_COOKIE} !^.*mredir=0.*$ [NC] RewriteRule ^/?(.*) http://m.domen.ru/$1 [L,R,NE,QSA]