Reputation: 2367
I have the following .htaccess file to redirect to the mobile version of my site:
RewriteEngine On
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]
However, I need to add a condition for mobile users to be able to request the desktop site.
I've searched around a bit and haven't found a simple answer. I just need to have an url such as http://www.example.com/?desktop to avoid the redirection to /mobile
Upvotes: 2
Views: 6970
Reputation: 1309
Try that:
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]
Upvotes: 6