我想这样做:有人在Facebook上分享我的手机页面。例如,单击该共享链接..但此用户习惯使用PC,而不是移动。
如果从PC进入移动页面,则会将人员重定向到桌面页面。
我的htaccess代码(移动页面):
RewriteCond %{REQUEST_URI} ^/mobile.*$
RewriteCond %{HTTP_USER_AGENT} !(android|blackberry|googlebot-mobile|iemobile|iphone|ipod|opera\smobile|palmos|webos) [NC]
RewriteRule ^ https://example.com%{REQUEST_URI} [L,R=302]
你能吗?
答案 0 :(得分:0)
这应该有效:
RewriteEngine On
RewriteCond %{HTTPS} ^off$
RewriteRule ^(.*)$ https://example.com/$1 [NC,L,R]
RewriteCond %{REQUEST_URI} ^/mobile.*$
RewriteCond %{HTTP_USER_AGENT} !(android|blackberry|googlebot-mobile|iemobile|iphone|ipod|opera\smobile|palmos|webos) [NC]
RewriteRule ^ https://example.com%{REQUEST_URI} [L,R=302]
请注意,您的htaccess中不需要www到非www重定向,只需1条规则即可删除www并将http更改为https。