CodeIgniter 404页面找不到,但为什么? [英] CodeIgniter 404 Page Not Found, but why?
问题描述
我使用CodeIgniter两个应用程序(公共和管理应用程序)。
文档结构的重要元素是:
/ admin
/admin/.htaccess
/admin/index.html
/ application
/ application / admin
/ application / public
/ system
.htaccess
index.php
/admin/.htaccess文件如下所示:
DirectoryIndex index.php
RewriteEngine on
RewriteCond%{REQUEST_FILENAME}!-f
RewriteCond%{REQUEST_FILENAME}!-d
RewriteRule ^(。*)$ ./index.php/$1 [L,QSA]
/admin/index.php有以下变化:
$ system_folder =../system;
$ application_folder =../application/admin; (此行存在两次)
而且/application/admin/config/routes.php包含以下:
$ route ['default_controller'] =welcome
$ route ['admin'] ='welcome';
欢迎是我的默认控制器。
当我调用域/管理我得到一个404页面未找到错误。当我调用域/ admin / welcome一切正常。在调试日志中,我收到以下错误消息:
DEBUG - 2010-09-20 16:27:34 - > ;配置类初始化
DEBUG - 2010-09-20 16:27:34 - > Hooks类初始化
DEBUG - 2010-09-20 16:27:34 - > URI类已初始化
错误 - 2010-09-20 16:27:34 - >找不到404页面 - >管理
很奇怪,这个设置在我的本地MAMP安装(与localdomain / admin /但是当我在live服务器上发布和测试它时,我只得到404错误。
有什么想法吗?我做错了什么?
感谢
C。
问题的原因是服务器使用FastCGI
$ config [ 'uri_protocol'] =REQUEST_URI;
一切正常。
I am using CodeIgniter for two applications (a public and an admin app). The important elements of the document structure are:
/admin
/admin/.htaccess
/admin/index.html
/application
/application/admin
/application/public
/system
.htaccess
index.php
The /admin/.htaccess file looks like this:
DirectoryIndex index.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
The /admin/index.php has the following changes:
$system_folder = "../system";
$application_folder = "../application/admin"; (this line exists of course twice)
And the /application/admin/config/routes.php contains the following:
$route['default_controller'] = "welcome";
$route['admin'] = 'welcome';
Welcome is my default controller.
When I call up the Domain/admin I get a 404 Page Not Found error. When I call up the Domain/admin/welcome everything works fine. In the debug logs I get the following error message:
DEBUG - 2010-09-20 16:27:34 --> Config Class Initialized
DEBUG - 2010-09-20 16:27:34 --> Hooks Class Initialized
DEBUG - 2010-09-20 16:27:34 --> URI Class Initialized
ERROR - 2010-09-20 16:27:34 --> 404 Page Not Found --> admin
Weirdly enough this setup works perfectly on my local MAMP installation (with the localdomain/admin/), but when I publish and test it on the "live" server, I just get 404 errors.
Any ideas? What am I doing wrong? Thanks C.
The cause of the problem was that the server was running PHP using FastCGI.
After changing the config.php to
$config['uri_protocol'] = "REQUEST_URI";
everything worked.
这篇关于CodeIgniter 404页面找不到,但为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!