I am new to yii. My urlmanager is not changing the get params...here is code of yiicode/protected/main.php
'urlManager'=>array(
'urlFormat'=>'path',
'rules'=>array(
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),
view code
$this->pageTitle=Yii::app()->name;
$params=array('city'=>'london');
$route='site/index';
$ur=$this->createUrl($route,$params);
html
<a href="<?php echo $ur;"?> >Click here to check London hotels</a>
on clik it goes to url /yiicode/index.php/site/index?city=london instead of /yiicode/index.php/site/index/city/london
You have to add rule like this.
'rules'=>array(
'site/index/city/<city:.*?>'=>'site/index',
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),