Username Vanity Url

Dear all,

I am very new to the Yii framework and I want to create my first website with it.

A user can register on my website and create a user name. After the registration process he should be able to access his own page(with custom css) with the url:

www.username.domain.com

or

www.domain.com/username

where "username" stands for his username he inserted in the user registration form.

where user login with this url and access own dashboard !!!

Thank you very much for your help!

Hi

First make it by controller/action

www.domain.com/index.php?r=user/index&uname=theusername

where action


public function actionIndex($uname) {

$user = UserModel::model()->findByAttributes('username'=>$uname);

if ($user){

//everything that you want

}

}

after of that see

http://www.yiiframework.com/doc/blog/1.1/en/final.url

to make

www.domain.com/index.php?r=user/index&uname=theusername => www.domain.com/username

0 down vote favorite

1

Basically i need to create a virtual sub domain for each and every user based on username in YII.

user login with own url like :

www.example.com is my main site

after create new test user it should be login with to

test.example.com

till he/she logout the url must be test.example.com

i use this functionality on localhost with creating virtual host.

please help to resolve this problem

Thanks in advance.

The first is different from the second one.

check these links

Ok,

this is my localhost(virtualhost) url - http://magazinecms.local/index.php?r=site/login

after login it’s url for ever user - http://magazinecms.local/index.php?r=setmagenv/index

so i want to display username after host name such as -

http://magazinecms.local/admin

http://magazinecms.local/user1

http://magazinecms.local/user2

etc.

so user access own dashboard via this login.

i want these url after login -

http://magazinecms.local/admin/index.php?r=setmagenv/index

http://magazinecms.local/user1/index.php?r=setmagenv/index

http://magazinecms.local/user2/index.php?r=setmagenv/index

etc.

Please help me, because i am very new in YII.