A
A
Artem2016-01-18 13:45:36
Yii
Artem, 2016-01-18 13:45:36

How to remove characters from url?

Good time! I have a website written with Yii.
The problem itself:
When a user logs in and enters the personal account, his url is like: site.com/c/id123, you need to make the ID itself, i.e. the numbers were not visible.
Tried hiding via .htaccess - didn't work. I ask for your help.
Thanks for your reply, all the best

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Melnichenko, 2016-01-18
@alex87melnichenko

You redirect after logging in to the personal account, keep user_id in the session, why do you need to pass it as a parameter.

if ($user_model->is_logged){
      $this->redirect(array('c'));
}

in controller C:
public function actionIndex(/*$user_id - сюда не передаешь*/)
$user_id = Yii::app()->user->get('id');
/*или*/
$user_id = $_SESSION['user_id'] /*в зависимости как ты там хранишь*/

not very familiar with Yii

W
winbackgo, 2016-01-18
@winbackgo

Store in session.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question