Check this article out to get started:
http://yiitutorials.net/easy/easy-url-rewriting-with-yii
You will bascially be storing the users custom URL in the database. So an example URL would be http://example.com/user/userurl
In your main config you could set up a rule like:
user/ => 'user/view' //second part is the controller/action
That rule defines that a URL with 'http://example.com/user/', the part after the slash can be accessed by a GET variable with the name 'customurl'. You can then access the users custom URL like so:
$_GET['customurl'];
And query the user record something like so:
$user = User::model()->find("customurl = '".$_GET['customurl']."'");
As mentioned below, here is an example from a real website. In this example the URL looks like so: http://website.com/blog/{post_title}/{post_id}
So the rule for this would be something like:
london-blog// => 'blog/viewpost'
So in our blog controller, we have an action called viewpost (see above how the rule is pointing to this controller/action?), which would look something like:
public function actionViewpost(){
$blogpost = Blog::model()->find("post_title = '".$_GET['post_title']."'");
...
}
So any URL that has the format london-blog/some_value/some_value will point to the controller action as specified in the config. You can then access the some_value parts using the variable names defined in the config (the bits in the < :.+>)
Hope that helps!