我已使用 this tutorial 设置了测试 SSL 证书。我的应用程序需要用户身份验证。正如预期的那样,我在加载登录页面时收到一条错误消息。当我尝试导航到任何其他页面或提交登录表单时,我收到 404 错误消息。
我的假设是,所有 URL 由于是由 Controller 创建的,因此不会再在 .htaccess
中重写。我不清楚如何解决此问题,以便除基本 index.php
文件之外的所有 URL 都能正常工作。
我的服务器详细信息如下:
- Apache 2
- Ubuntu 12.04
- Codeigniter 2(2 的某些版本)
这是我的 .htaccess
文件:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
</IfModule>
最佳答案
关于php - Codeigniter - 设置 SSL 并收到 404 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27723284/