【发布时间】:2019-04-12 01:57:00
【问题描述】:
我有一个使用 Codeigniter HMVC 构建的网站。在我使用 Wamp 的本地机器上,它运行正常。我想将它上传到具有 SSL 证书的网络服务器。
无论我尝试什么,我都无法让网站在我的网络服务器上运行。我试过遵循这个: How to force ssl in codeigniter? 但是在我的情况下,没有一个给定的解决方案。
我的 .htaccess 文件如下所示:
Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
在我有的codeigniter的config.php中:
$config['base_url'] = 'https://www.example.com/';
我的网络服务器是带有 apache 的 ubuntu 16 机器,使用 Letsencrypt 证书。 mod rewrite 已启用,但除此之外是标准配置。
我已尝试使用上面链接中提到的挂钩进行重定向,但无济于事。我也尝试了各种 .htaccess 文件配置,但也没有结果。
有人在他们的服务器上运行这个吗?
问候,
砂光机
【问题讨论】:
-
您正在使用 LetsEncrypt。您是自己生成证书还是使用 Certbot? certbot 的一项很酷的功能是您可以让它进行必要的更改以将所有 http/80 流量重定向到 https/443
标签: apache codeigniter ssl