站点介绍
Apache + .htaccess
可以在.htaccess文件中添加以下规则来强制https访问:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
修改过的.htaccess文件如下:
<IfModule mod_rewrite.c>RewriteEngine OnRewriteBase / # 添加以下规则以强制使用HTTPSRewriteCond %{HTTPS} offRewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]</IfModule>