.htaccess 控制器在CodeIgniter中未打开

.htaccess 控制器在CodeIgniter中未打开,.htaccess,codeigniter,controller,.htaccess,Codeigniter,Controller,我在CodeIgniter应用程序中有三个控制器-I、login和test 所有控制器都能完美地使用/APP/index.php/路径-我可以打开/APP/index.php/I、/APP/index.php/login和/APP/index.php/test 控制器i和login在没有index.php的情况下工作-/APP/i和/APP/login(我有一个修改过的.htaccess文件) 控制器test在没有index.php的情况下无法工作-我打开/APP/test时出现404错误 i是

我在CodeIgniter应用程序中有三个控制器-
I
login
test

所有控制器都能完美地使用
/APP/index.php/
路径-我可以打开
/APP/index.php/I
/APP/index.php/login
/APP/index.php/test

控制器
i
login
在没有
index.php
的情况下工作-
/APP/i
/APP/login
(我有一个修改过的
.htaccess
文件)

控制器
test
在没有
index.php
的情况下无法工作-我打开
/APP/test
时出现404错误

i
是默认控制器,但是
login
不是默认控制器,它可以工作(我认为这可能是问题所在)

当我添加第四个控制器时,如果没有
index.php
,它也无法工作

更奇怪的是,有时我可以打开
/APP/test/some_function
(有时我不能),然后我甚至可以打开
/APP/test
。但是这样我就不能再打开了
index.php
way一直在工作<代码>测试控制器有一个非常简单的代码

因此,我的问题是,这里可能会出现什么问题,以及在没有
index.php
的情况下,如何使我的控制器可以访问

非常感谢你的帮助

下面是我的
.htaccess
文件,我认为问题可能在那里:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /APP/

RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ index.php?/$1 [L]

RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ index.php?/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule>

重新启动发动机
重写库/应用程序/
重写COND%{REQUEST_URI}^系统*
重写规则^(.*)$index.php?/$1[L]
重写cond%{REQUEST_URI}^应用程序*
重写规则^(.*)$index.php?/$1[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php?/$1[L]
ErrorDocument 404/index.php

多亏了我的建议,我现在明白问题出在哪里了

实际上,当您在没有
index.php
文件的情况下访问控制器时,主应用程序文件夹会区分大小写(我的问题是
APP

由于我有一个更长的应用程序文件夹名称,它有小写和大写字母,我只是让人用一个字母打错了。对于默认控制器,这无关紧要,其他控制器通过案例正确的链接访问

由于直接访问了
test
,这个错误的案例给了我404错误


通过
index.php
path,主应用程序文件夹的大小写无关紧要。

您没有一个名为
test
的目录作为index.php的邻居,是吗?您是否设置了
$config['index\u page']=''
config.php
文件中。不,我没有目录
test
(你是说top-level index.php,对吗?反正也没有这样的目录……好主意,顺便说一句,我从来没有想到要检查)。是的,
$config['index.php']=''
。。。谢谢。@esp将日志设置为调试级别并检查日志,看看通过阅读它是否可以得到任何线索非常感谢。我现在明白问题出在哪里了。实际上,当您在没有
index.php
文件的情况下访问控制器时,主应用程序文件夹会区分大小写(我的问题是
APP
)。由于我有一个更长的应用程序文件夹名称,它有小写和大写字母,我只是让人用一个字母打错了。对于默认控制器,这无关紧要,其他控制器通过案例正确的链接访问。由于直接访问了
test
,这个错误的案例给了我404错误。通过
index.php
path,这种情况无关紧要。