#Chrome 68之后的版本,所有HTTP网站都会被标识为not secure,也就是不安全,我们要求之后的版本全部定向到HTTPS
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} off
#默认情况下,条件为与的关系,我们把符合Chromium并且版本号在68之下的版本排除即可
#下面的expr功能是Apache 2.4新增的功能,2.2版本是不支持的
# strmatch 大小写区分 strcmatch大小写不区分
RewriteCond expr "%{HTTP_USER_AGENT} -strcmatch '*Chromium/*'" [OR]
RewriteCond expr "%{HTTP_USER_AGENT} -strcmatch '*Chrome/*'"
RewriteCond expr "! %{HTTP_USER_AGENT} -strcmatch '*Chromium/([0-5][0-9]|6[0-7])\.'"
#腾讯云服务器,由于目前的设置问题,暂时不能强制重定向,本站专属问题,其他网站不需要限制此项
RewriteCond expr "! %{HTTP_HOST} -strcmatch '182.254.149.39'"
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>