使用htaccess将网站redirect到HTTPS和www

我在我的.htaccess文件中使用了这个代码:

 RewriteEngine On RewriteCond %{HTTP_HOST} ^silkgifts.co.uk RewriteRule (.*) https://www.silkgifts.co.uk/$1 [R=301,L] 

它将我的HTTPS非www引导到HTTPS www站点,并将HTTP非www引导到HTTPS www站点。 但是,并不是将HTTP www指向https www。

我也在这个代码中尝试解决这个问题:

 RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 

在谷歌search控制台工作,但在其他网站上testing时,它说有一个无尽的redirect链,所以我删除了它。

谁能告诉我我要去哪里?


编辑:当前.htaccess文件:

 AddHandler php56-script .php .php5 ## EXPIRES CACHING ## <IfModule mod_expires.c> ExpiresActive On ExpiresByType image/jpg "access plus 1 year" ExpiresByType image/jpeg "access plus 1 year" ExpiresByType image/gif "access plus 1 year" ExpiresByType image/png "access plus 1 year" ExpiresByType text/css "access plus 1 month" ExpiresByType application/pdf "access plus 1 month" ExpiresByType text/x-javascript "access plus 1 month" ExpiresByType application/x-shockwave-flash "access plus 1 month" ExpiresByType image/x-icon "access plus 1 year" ExpiresDefault "access plus 2 days" </IfModule> ## EXPIRES CACHING ## RewriteEngine On RewriteCond %{HTTP_HOST} ^silkgifts.co.uk RewriteRule (.*) https://www.silkgifts.co.uk/$1 [R=301,L] RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]