Answer the question
In order to leave comments, you need to log in
How to save page url when switching site to Yii?
The situation is this: the site is translated into Yii, and you need to save the paths to some pages, due to the fact that they are well indexed by the search engine.
Task:
There are pages with a URL like:
site.ru/seo_word1
site.ru/seo_word1/filter1/param1
, etc.
At the moment, the paths on the version with the yii engine are:
site.ru/site/index/section/1
site.ru/ site/index/section/1/filter1/param1
What are the ways to solve the problem?
Answer the question
In order to leave comments, you need to log in
In Yii, you can write any kind of urls you want using routing. If I understand you correctly, then you have 3 get parameters seo_word, filter, param
in the config, you can write a rule
'components'=>array(
…
'urlManager'=>array(
'urlFormat'=>'path',
'rules'=>array(
'<seoword:\w+>/<filter:\w+>/<param:\w+>'=>'site/index'
),
),
),
public function actionIndex() {
Yii::app()->request->getParam("seoword")
Yii::app()->request->getParam("filter")
Yii::app()->request->getParam("param")
$this->render('index');
}
public function actionIndex($seoword,$filter,$param) {
$this->render('index');
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question