我想这么做:有人在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] 你能不能?
发布于 2015-12-13 08:26:30
这应该是可行的:
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 to non www重定向,只需一条规则就足以删除www并将http更改为https。
https://stackoverflow.com/questions/34243561
复制相似问题