我有一个 codeigniter 站点,我希望它始终强制使用 ssl。我正在使用 htaccess 文件删除丑陋的 index.php
这是我现在拥有的 htacces 文件的内容...
RewriteEngine on
RewriteCond $1 !^(index\.php|static|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
我必须做什么才能让它始终使用 ssl?
谢谢!
最佳答案
试试这个:
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]
关于php - 使用 codeigniter htaccess 在整个站点上强制使用 ssl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15589057/