[eluser]mddd[/eluser]
If you ALWAYS want to go to the index method you can use this route:
Code:
$route['user/(.*)'] = 'user/index/$1';
This makes /user/john go to user/index/john. And you're done.
If you want to rewrite but also want to keep the possibility of other methods in the controller,
you can use the _remap method. If there is a _remap method in the controller, it is always executed!
Check the manual page about routes for more info.
Code:
function _remap($requested_method)
{
// check if a function was requested that we know what to do with
if ($requested_method=='list')
// show a list of users
else
// the requested method isn't anything we know about, so treat it as a username that we show through the index method
$this->index($requested_method);
}