codeigniter get all declared routes
From Controller you can do this
print_r($this->router->routes);
It will show all the routes defined in routes.php.
First of all I'm sorry for my English because "I am NOT SCHOOL". I didn't get much what you are trying to point out. Maybe you want to do similar with this http://www.hirepinoy.com/born2code.But in my experience with CodeIgniter,it is a bad idea to declare $route['(:any)'] = 'customer/profile/$1';
in your routes.
I think the best option you can do is that to create a class to check if username exist in the table of users by using HOOK see http://codeigniter.com/user_guide/general/hooks.html.So therefore when username (unique field) returned then you can modify the $_SERVER['REQUEST_URI']
to be like this
$_SERVER['REQUEST_URI'] = '/customer/profile/'.$username;
So basically it will modify the SERVER REQUEST before the codeigniter core process it's core processing.
Now, the problem maybe, is when user registered a username that is the same with your controller for sure will not be process since it was modified to route on costumer/profile/blahblah
. All you need to do is to create a custom validation to check weather the username already exists on database and or your controller name.
You can do like
if (file_exists(APPPATH."controllers/{$value}.php")) { $this->CI->form_validation->set_message('is_unique', 'Username is already taken'); return FALSE;}