2

我有以下 .htaccess 文件可以重定向到我的网站的移动版本:

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]

但是,我需要为移动用户添加一个条件才能请求桌面站点。

我搜索了一下,没有找到一个简单的答案。我只需要一个网址,例如http://www.example.com/?desktop以避免重定向到 /mobile

4

1 回答 1

6

试试看:

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]
于 2013-01-09T16:17:44.973 回答