更新时间:2023-09-19 10:35:34
通过其他提供的答案组合来强制执行https和www。
Forcing https and www is done by a combination of other provided answers.
这似乎可行:
RewriteCond %{ENV:HTTPS} !on [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
RewriteCond %{ENV:HTTPS} on [NC]
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]