Is there a way to have a full site button in a mobile application without javascript?

I am currently redirecting to an htaccess-based mobile site as follows:

RewriteEngine On RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos" [NC] RewriteRule ^$ http://m.example.com/ [L,R=302] 

Is there any way to have a full site button on my mobile version that will ignore this rule if clicked? I don't want to use javascript to do my redirection and check to the full site ... I am fine with the idea of โ€‹โ€‹php, but I know that htaccess gets off to php rules.

+5
source share
1 answer

You can create a / href button link with this url:

 <a href="/?desktop=1">Full Desktop Site</a> 

And then change your rewrite as follows:

 RewriteEngine On RewriteCond %{QUERY_STRING} !(^|&)desktop=1(&|$) [NC] RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos" [NC] RewriteRule ^$ http://m.example.com/ [L,R=302] 
+2
source

Source: https://habr.com/ru/post/1206393/


All Articles