In the urlManager component within the config/main.php
'user/<username:\d+>' => 'user/view' // will need to change \d+ if not working with numbers only.
That will change the url structure. What did you mean about entering?
Question
Now in my Yii application I have th following userpage access url.
mysite/users/view?username=123
which loads view file of users controller.
What I want to do is to simplify URL to this
mysite/users/123
And entering this I want to access the same page.
Is that possible ? For now my View action of UsersController is here :
public function actionView($username){
$model = User::model()->findByAttributes(array(
"username" => $username
));
if($model){
$this->render("view", array(
"model" => $model
));
}
}
Solution
In the urlManager component within the config/main.php
'user/<username:\d+>' => 'user/view' // will need to change \d+ if not working with numbers only.
That will change the url structure. What did you mean about entering?