codeigniter routing issue

I had my users profile at

www.domain.com/user/username

and moved it at

www.domain.com/username

but this required to add most classes functions into the routes.php file in the config and if i want to add new features to my app i will need to add all the functions into the routes.php file which doesnt sound good practice...

What is the best way that other deal with it on CodeIgniter ?

Answers


Perhaps, you can do it the other way round - make a whitelist of usernames that can't be taken (those would be names of your controllers, like admin, contact, etc...) and route anything except the whitelist items.


seems i got the answer

what i did is add the below code for every controller i have

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

and this code at the bottom

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

Need Your Help

how to call view events in loop in backbone js

javascript jquery backbone.js backbone-views backbone-events

i want to fire on_change events on dynamically created drop boxes.

Does mmap allocate a page or part of a page?

c++ c linux mmap mprotect

I'm confused, does mmap allocate an entire page of memory (regardless of size specified), or does it just allocate the size you request? Really, I'm curious about what happens on subsequent calls t...