[eluser]vivid_haze[/eluser]
Please take a look at what's in my codeigniter config/routes.php file:
Code:
$route['default_controller'] = "primary";
$route['404_override'] = '';
$route['(:any)'] = 'primary';
$route['login'] = 'login';
$route['admin'] = "admin";
$route['admin/(:any)'] = 'admin/$1';
So, I want pretty much any page request to be directed to my 'primary' controller, where it will be taken care of by the index() function there. There are a few exceptions;
login goes to
login,
admin to
admin. That's all working fine. The problem lies in the last rule, which doesn't seem to work as it should; '
admin/whatever' just gets routed back to my primary controller. Why?
I would actually like to route any admin requests normally, so
admin/whatever/ goes to
admin/whatever/, and
admin/whatever/whatever/ goes to
admin/whatever/whatever/. There could be many segments, and there are too many to list individual rules (exceptions to the first
$route['(:any)'] = 'primary'; rule). Is there a way to do this?
ie. Any url with the first segment 'admin' gets routed to the admin controller (just as codeigntier would work normally). However, this needs to be stated as an exception to the first
$route['(:any)'] rule?
I'm fairly new to codeigniter, so apologies if answers are glaringly obvious. I've spent the last few hours digging around for answers though, and can't find any.