I\'m new to CodeIgniter and I\'ve just gone through some of their user guide to help me understand how to do multiple controllers.
I have figured out how to load mul
The problem is that this rule:
$route['(:any)'] = 'site/index/$1';
intercepts everything... and passes it to the Site
controller, as an argument to the index
method. So if you call:
/mycontroller
it will actually map to:
/site/index/mycontroller
The routing happens before the app even looks at the controllers, and the routing rules are considered in order they are written.
Thus you need to put this rule at the very bottom of your rule list in order to let the other rules work. So by adding this in front:
$route['mycontroller'] = 'mycontroller';
$route['(:any)'] = 'site/index/$1';
it should work fine (although sligthly unusual approach, but so is your global any
rule) as it will first check if the URL requested was /mycontroller
and if so, it will call myController
; otherwise it will behave like it used to with your Site
controller.