Seamy
Seamy

Reputation: 307

Issue routing code igniter

Hey I am having an issue routing to my other controllers in codeigniter.

Basically this is my base url http://localhost:8012/CodeIgniterProject/

This works fine but every time I type something after it I get an object not found error. I am trying to route to my Dashboard.php controller but having no luck. I want to type http://localhost:8012/CodeIgniterProject/dashboard and hit the Dashboard controller.

  $route['default_controller'] = 'home';
  $route['404_override'] = '';
  $route['translate_uri_dashes'] = FALSE;

  $route['home/(:any)'] = "dashboard";
  $route['(:any)'] = "";
  $route['404_override'] = 'dashboard';

  $route['Dashboard'] = "dashboard";
  $route['about'] = "site/about";

I know this might be simple to other people but I don't usually work in php and this has me a little stumped. I was under the impression codeigniter would pick up dashboard from my controllers folder and got to my controller class to load it? And then if I wanted to pass params to the class etc I'd just need to add e.g /123??? Thanks for your time.

Upvotes: 1

Views: 30

Answers (1)

Mahdi Majidzadeh
Mahdi Majidzadeh

Reputation: 868

define method too, like:

$route['Dashboard'] = "dashboard/index";

Upvotes: 2

Related Questions