问题描述
我正在使用CI版本3.1.0
i am using CI version 3.1.0
并在我的httacces文件中
and inside my httacces file like this
RewriteEngine on
RewriteCond $1 !^(index\.php|public|\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1
而且我已经将配置文件更改为 $ config ['index_page'] =''
and i have change my config file to $config['index_page'] = ''
我不能工作但是CI似乎找不到从from url请求的控制器。
示例 localhost / site / index.php / welcome
其工作按预期进行,但是当请求 localhost / site / welcome 时code>我找不到404页。
i'ts work but CI seem cant find controller that request fromm url.example localhost/site/index.php/welcome
its work as expected, but when request it with localhost/site/welcome
i got 404 page not found.
推荐答案
您能否尝试用
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
这也取决于托管,我也注意到了,所以这可能行不通。是否启用了mod_rewrite或等效功能?
It depends a bit on the hosting, too I've noticed so this might not work. Is mod_rewrite or equivalent enabled?
如果您的应用程序在目录/ site /中运行,您在$ config ['base_url']中放了什么?
If your application is running inside the directory /site/, what did you put in $config['base_url']?
这篇关于codeigniter .htaccess工作,但找不到控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!