Reputation: 3935
In my project, have setup an admin panel under a folder inside controllers folder like this
controllers/admin_panel/dashboard.php
And when we open it like this, it loads dashboard
controller default
http://www.mysite.com/admin_panel
Now I have added a page
controller on root level to load the page content from database. So here I have some a setup of kind of CMS. To load the page controller, I have added a condition in routes as below
$route[':any'] = "page";
But what it is doing now is, when I try to open admin_panel, it loads the page controller.
So I want to add a kind of exception condition here like route any except admin_panel
Any suggestions how can I achieve this ?
Thanks in advance.
Upvotes: 0
Views: 2664
Reputation: 9858
You can just define another route right above that one that will take you to the admin panel. In CodeIgniter, routes will run in the order they are defined.
$route['admin_panel'] = 'admin_panel';
$route[':any'] = 'page';
You should be able to access the admin_panel with the above routing.
Upvotes: 1