I have a mobile site and it has just started a service for desktop users also. How do I use .htaccess to redirect users using the desktop to the desktop version of the site?
I have tried simple PHP scripts to redirect to the home page of the desktop version, but I would like the redirect to be slightly more efficient. For example, I would like to redirect http://site.com/subfolder/ to http://site.com/desktop/subfolder/, and I figured that using .htaccess might be able to get the job done.
I have tried the following and it doesn’t seem to work.
RewriteCond %{REQUEST_URI} !^/desktop/.*$
RewriteCond %{HTTP_USER_AGENT} "!android|!blackberry|!ipad|!iphone|!ipod|!iemobile|!webos|!googlebot-mobile" [NC]
RewriteRule ^(.*)$ /desktop/ [L,R=302]
Please help!
Try these rules in your .htaccess file:
Update (combined with wordpress rules)
R=302 will redirect with https status 302
L will make last rule
NE is for no escaping query string
$1 is your REQUEST_URI