用户和管理界面的CodeIgniter路由

I'm creating a website using CodeIgniter, and I want to have an admin interface and a user interface.

Im using this aproach

  • controller/

    • admin/dashboard.php
    • admin.php ( loads admin/login.php view )
    • dasboard.php
  • models/

    • admin/
  • views/

    • admin/dashboard.php, login.php
    • dasboardh.php, login.php

Ok if I go to example.com/admin it works, it loads the login view, but If I want to go to example.com/admin/dashboard it doesn't load.. says page not found

I've tried adding to the routes the followinf route['admin/dashboard']='admin/dashboard'; but it continues not to work. Also in my url's I have always the index.php and I can't take it off with htacess, here is my htaccess:

php_flag display_startup_errors on  
php_flag display_errors on  
php_flag html_errors on

RewriteEngine on  
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

Every help would be aprecciated, thanks a lot!

For user

$route['(inbox|sent|trash)'] = "message/$1";
$route['(settings|change_password|signout)'] = "account/$1";

For admin

$route['(inbox|sent|trash)'] = "admin/message/$1";
$route['(settings|change_password|signout)'] = "admin/account/$1";

make sure that all keys in $route should be defined in specified controller

You can remove the admin controller and create a controller with name login inside the admin folder that will work fine. Because Codeigniter look for a method dashboard when you have admin.php controller already.