I’m developing a site where a lot of users will be subscribed. I thought, to view a user profile, I’ll do via the profile controller, example.com/profile/username, where “username” is somebody from the database.

What’s the best way to do this?

Also… It’s possible to view a user’s profile like example.com/username ?

Thank you in advance!


read this article


on this Find " /Manufacturer/Model "


Thank you for the reply!

Actually there is no need to complicate things like manufacturer/model, the solution is more simple!

Here is the solution I found:

I want: www.example.com/profile/any_user_name

  1. Create ProfileController.php

class ProfileController extends Controller {

	public function actionIndex($username) {


		if ($user === null)

			throw new CHttpException(404,'User '.CHtml::encode($username).' not found!');

		$this->render('index', array('user'=>$user));



  1. Create the index.php in views/profile/

  2. add the rule in the config/main.php


	'rules' => array(