When using
$route['(:any)'] = 'pages/view/$1';
and I want to use other controllers in my routing for example:
$route['del/(:any)'] = 'crud/del';
it won't work. I guess it will use
pages/view/del/$1
and not my crud-controller when deleting an item. How can I solve this?
Its hundred percent working
As indicated,
$route['(:any)']
will match any URL, so place your other custom routes before the "catch-all" route:I know that it's an old question, but I have found myself a nice solution.
By default, CodeIgniter gives priority to URL's from routes config (even if straight controller, method etc. specified), so I have reversed this priority this way:
In
system/core/Router.php
find_parse_routes
method.Add this code under literal route match:
I agree, that this approach is kinda wrong, because we edit file from system/core, but I needed a fast soluttion to work with a lot of URL's.