我在重新映射codeigniter时遇到404错误,这是我的方案:
1 - 我有一个控制器:USER
2 - 当我的用户登录时,它将重定向到USER/DASHBOARD
但我在DASHBOARD
控制器中没有任何名称USER
的功能,我按名称给了它一个特定的控制器{ {1}}但是当我去DASHBOARD
时,它给了我404错误......
以下是我现在所做的事情:
1-我的根.htaccess文件:
USER/DASHBOARD
2-我的config.php更改:
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
RewriteCond $1 !^(index\.php|images|css|robots\.txt)
3-我的routes.php更改:
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
4-我在DASHBOARD控制器中有index()函数,它给出了如下输出文本:
$route['user']="user";
$route['user/dashboard']="dashboard";
$route['default_controller'] = "main";
$route['404_override'] = "";
感谢您的帮助:)
答案 0 :(得分:0)
将此更改更改为 routes.php
$route['default_controller'] = "main";
$route['404_override'] = "";
//reserved routes must be first
$route['user/dashboard'] = "dashboard";
//get rid of the user route, what does it do?