【发布时间】:2016-05-17 12:41:28
【问题描述】:
我使用 godaddy 作为我的服务器提供商,我购买了 SSL 证书。它让我对 CodeIgniter 项目中的 index.php 感到有些头疼。我无法从我的网址中删除 index.php。
我四处研究并尝试了我发现的所有东西,但对我没有任何作用,所以请不要将其视为双重。
如果:https://example.com/index.php/home - 工作得很好
如果:https://example.com/home
我收到 404 错误。未找到 在此服务器上未找到请求的文档。
到目前为止,我已经在我的 htaccess 文件中停止了这些条件:
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} (sale|success|cancel) [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !(static|sale|success|cancel) [NC]
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond $1 !^(index\.php|resources|robots\.txt|static) [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
任何建议都会有所帮助。谢谢!
【问题讨论】:
-
您是否也更改了
$config['index_page'] = '';in application/config/config.php? -
你的 Apache 允许 mod_rewrite 吗?
-
我在 godaddy 上使用 Windows 服务器,所以当我阅读时,他们不提供 mod_rewrite。所以我在我的
.htaccess文件中写了这个。Options +FollowSymLinks Options +Indexes Options -MultiViews RewriteEngine On RewriteBase /在文档中这几行,写得等了一个小时。我会看看会发生什么..
标签: .htaccess codeigniter ssl