Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to have a full site button on a mobile app without javascript?

I currently an redirecting to a mobile site based through htaccess 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 someway 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 redirect and check for full site...I'm okay with the idea of php doing it though, but I know htaccess gets knocked off before php rules.

like image 590
Dom Avatar asked Nov 01 '22 14:11

Dom


1 Answers

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

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

And then change your rewrite as this:

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]
like image 155
anubhava Avatar answered Nov 08 '22 12:11

anubhava