保留主页重定向,但将 http 更改为 https 全站范围(包括子域)


Keep homepage redirect, but change http to https sitewide (including subdomains)

我检查了其他htaccess问题和答案,但似乎没有任何效果适用于这种情况。

下面的代码是我当前的htaccess文件。主页有一个重定向,我需要保留。我有该站点的SSL密钥和证书,我只需要将http更改为https即可。

我相信这并不复杂,这只是我目前的知识。

请帮忙!

RewriteEngine on
RewriteCond $1 !^(index'.php|admin|gadgets|images|editor|user_guide|captcha|system|css|utils|src|themes|tools|xinha|uploads|js|robots'.txt)
RewriteRule ^(.*).html /$1 [L]
RewriteCond %{HTTP_HOST} ^startuptoolshop'.com$ [OR]
RewriteCond %{HTTP_HOST} ^www'.startuptoolshop'.com$
RewriteRule ^/?$ "http':'/'/startuptoolshop'.com'/index'.php'/categories" [R=301,L]
将此

规则插入正下方RewriteEngine on

RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

把这段代码放在 .htaccess 文件中:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}