Reputation: 5883
I'm trying to achieve the following behavior: http://example.com/anything
should pass anything
to a default controller (namely, "category_browser"), unless anything
is a controller name.
The first part is easily achieved with this line in config/routes.php
:
$route[':any'] = "category_browser";
while I did not manage to get the second one to work.
I would really appreciate any input.
Other info: the number of controllers is pretty small; writing an options line for each of them is an option; they should be passed parameters.
Upvotes: 2
Views: 239
Reputation: 12883
Use this: http://pinoytech.org/blog/post/CodeIgniter-Route-Everything-except-these-Controllers
$route['^(?!controller|controller|controller)\S*'] = "article/$1";
Upvotes: 2
Reputation: 19251
create a master controller that you point everything to. in the master controller, check if the set controller name exists, if so, run it, if not, call category_browser using controller name as method instead.
Upvotes: 1