这是对的吗?
我尝试导航到www.alltheoptions.co.uk
,但它没有重定向到https://
版本
# Redirect Browser to https
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.alltheoptions\.co.uk$ [NC] [OR]
RewriteCond %{HTTP_HOST} !^\alltheoptions\.co.uk$ [NC] [OR]
RewriteCond %{HTTP_HOST} !^\http://alltheoptions\.co.uk$ [NC]
RewriteRule ^(.*)$ https://www.alltheoptions\.co.uk/$1 [R=301,L]
# Block Unwanted User Agents - Spiders/Bots
<IfModule mod_rewrite.c>
SetEnvIfNoCase ^User-Agent$ .*(bot1|bot2|bot3|bot4|bot5|bot6|) HTTP_SAFE_BADBOT
SetEnvIfNoCase ^User-Agent$ .*(bot1|bot2|bot3|bot4|bot5|bot6|) HTTP_SAFE_BADBOT
Deny from env=HTTP_SAFE_BADBOT
</ifModule>
# Security - name to access htaccess file
AccessFileName ht.access
答案 0 :(得分:1)
您可以将第一条规则更改为:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.alltheoptions\.co\.uk$ [NC,OR]
RewriteCond %{HTTPS} !on
RewriteRule ^ https://www.alltheoptions\.co.uk%{REQUEST_URI} [R=301,L,NE]