如何配置codeigniter站点的SSL?

时间:2017-02-17 07:45:13

标签: php codeigniter

我的.htaccess文件

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

2 个答案:

答案 0 :(得分:2)

你应该有这样的东西

RewriteRule ^.*$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

尝试用此

替换您的规则

答案 1 :(得分:1)

复制下面的代码并粘贴到 .htaccess 文件中:

#First rewrite any request to the wrong domain to use the correct one (here www.)
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

#Now, rewrite to HTTPS:
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]