无法访问子文件夹中的控制器 [英] Unable to access the controller in subfolder
本文介绍了无法访问子文件夹中的控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
正如我之前的问题中所述,我使用像 myproject-local.com/admin/index
的URL来处理这个问题,但现在我已经添加了另一个控制器,当我去 myproject-local.com/admin/category
时,它会给我 404
As stated in my previous question, I some how managed to cop up with this one, by using the URL like myproject-local.com/admin/index
But now I have added another controller, say category in admin directory and when I go to myproject-local.com/admin/category
, it gives me 404
Routes.php
Routes.php
$route['default_controller'] = "welcome";
$route['admin/(:any)'] = "admin/admin/$1";
$route['404_override'] = '';
.htaccess
.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
我已设置 $ config ['index'] =''
and I have set $config['index'] = '';
in my config.php
推荐答案
尝试此方法
$route['default_controller'] = "welcome";
$route['admin/category/(:any)'] = "admin/category/$1";
$route['admin/(:any)'] = "admin/admin/$1";
$route['404_override'] = '';
这篇关于无法访问子文件夹中的控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文