C
C
Coraelstraze2017-04-09 22:31:55
Mobile development
Coraelstraze, 2017-04-09 22:31:55

Redirecting to the mobile version from all pages of the site?

Hello! You need a normal redirect from the main to the mobile version of the site when using a mobile device. I'm not kidding myself.
Found on the Internet

RewriteEngine On 
RewriteCond %{HTTP_ACCEPT} "text/vnd.wap.wml¦application/vnd.wap.xhtml+xml" [NC,OR] 
RewriteCond %{HTTP_USER_AGENT} "acs|alav|alca|amoi|audi|aste|benq|blac|blaz|brew|cell|cldc|cmd-" [NC,OR] 
RewriteCond %{HTTP_USER_AGENT} "dang|doco|erics|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|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-|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|android|mobile|pda|psp" [NC]
RewriteRule ^(.*)$ http://m.stroyartel-kazan.ru/$1 [NC,L]

In general, I enter the main address of the site stroyartel-kazan.ru, everything is fine. And if I type with a page, for example stroyartel-kazan.ru/catalog, then the transition to the mobile version does not occur. How can this code be improved? Or maybe there are easier and better options? Tell me please!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey Goryachev, 2017-04-09
@webirus

If the site is in php, then it seems to me that mobiledetect.net would be better

M
Mark, 2017-04-10
@Mark54

Even with a good Internet connection, the pictures are barely loading on your site.

V
Viktor Taran, 2017-04-10
@shambler81

1. I would like your disco to be cut off ;(
2. you also have a reverse redirect to a non-mobile one, can you show the entire .htaccess.
3. have you tried to typeset on bootstrap?
4. RewriteRule ^(.*)$ m.stroyartel-kazan.ru/$1 [NC,L] - clearly says that with logic all the rules and problems are not in this rule.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question