如何将.htaccess文件写入https://www.domain.com
例如
domain.com => https://www.domain.com
www.domain.com => https://www.domain.com
https://domain.com => https://www.domain.com
http://www.domain.com => https://www.domain.com
答案 0 :(得分:2)
请尝试以下规则:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
答案 1 :(得分:0)
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)$ https://www.domain.com/$1 [R=301,L]
这是我使用的代码。我也在http://htaccess.madewithlove.be/检查了它:)