rstewart8
rstewart8

Reputation: 99

Codeigniter url routes

I have the following in my codeigniter routes.php file:

$route['default_controller'] = "home";
$route['404_override'] = '';
$route['(:any)'] = "page";
$route['about'] = "about";
$route['content/edit'] = "content/edit";
$route['content'] = "content";

localhost/anything routes to page controller like it should. localhost/about and localhost/content route to the about controller and content controller like they should. But localhost/content/edit routes to page controller. I need it to route to the edit function in my content controller. How do I accomplish that? Thanks.

Upvotes: 0

Views: 47

Answers (1)

Craig
Craig

Reputation: 1823

Routes will run in the order they are defined. Higher routes will always take precedence over lower ones.

I am guessing this is why it's routing to the page controller.

Try moving;

$route['content/(:any)'] = "content";

Above:

$route['(:any)'] = "page";

Upvotes: 1

Related Questions