
Apache + .htaccess
可以在.htaccess文件中添加以下规则來強制https访問:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
修改過的.htaccess文件如下:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# 添加以下规则以強制使用HTTPS
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>






添加好友