Tuesday, April 15, 2014

Redirecting mobile to full site (desktop) view of the page

This redirection process works in .htaccess. What it does is detect the device and redirect the user to the appropriate page.

Place the below code into your .htaccess

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

Create a link that goes to www.example.com/?desktop

Once user click the links, it will pass the query "desktop" to your .htaccess and it will bypass reading the device. Hope this helps. 



.

No comments: