0

我有一个 codeigniter 站点,我希望它一直强制使用 ssl。我正在使用 htaccess 文件删除丑陋的 index.php

这是我现在拥有的 htacces 文件的内容...

 RewriteEngine on
 RewriteCond $1 !^(index\.php|static|robots\.txt)
 RewriteRule ^(.*)$ /index.php/$1 [L]

我该怎么做才能让它始终使用 ssl?

谢谢!

4

2 回答 2

3

尝试这个:

RewriteEngine On
#RewriteCond %{HTTPS} !=on
RewriteCond %{HTTPS} off
#RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond $1 !^(index\.php|static|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
于 2013-03-23T16:31:28.613 回答
0

尝试这个:


RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://www.domain.com/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php?/$1

于 2013-03-23T16:31:30.210 回答