Redirect 检测手机或平板电脑时重定向到https

Redirect 检测手机或平板电脑时重定向到https,redirect,mobile,https,Redirect,Mobile,Https,我想在检测mobile或teblet而不是pc/laptap时重定向到https。在pc和笔记本电脑上,我想使用plan http。我尝试使用下面的htaccess代码,但在所有移动/平板电脑/pc/笔记本电脑设备上都会重定向到https 我也尝试了移动检测php脚本,但没有成功 <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_HOST} !^www\. RewriteCond %{HT

我想在检测mobile或teblet而不是pc/laptap时重定向到https。在pc和笔记本电脑上,我想使用plan http。我尝试使用下面的htaccess代码,但在所有移动/平板电脑/pc/笔记本电脑设备上都会重定向到https

我也尝试了移动检测php脚本,但没有成功

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteCond %{HTTPS} !=on
    RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R,QSA]
</IfModule>

重新启动发动机
重写cond%{HTTP_HOST}^www\。
重写cond%{HTTPS}=在…上
重写规则^(.*)$https://www.%{HTTP_HOST}/$1[R,QSA]

我可以问一下,您为什么要让pc/笔记本电脑用户不安全?此外,由于您不能使用HSTS+预加载,唯一针对MITMhttp的真正保护比https快,我们居住在巴基斯坦,大多数用户来自使用蜂窝网络的移动设备,我们的蜂窝网络在非https网站上的广告下弹出。所以我想将移动用户重定向到https。使用spdy/http2,https比http更快。你应该试一试:谢谢你@Tom买了。。https速度更快…可能会重复