Reputation:
I'm newbie on Yii, I'm facing some difficulties on create Yii SEO Friendly url.
My code is below:
echo CHtml::link($Menu->label, array('articles/view', 'id'=>$Menu->link,
This solution below config/main:
return array(
// ......
'components'=>array(
// ......
'urlManager'=>array(
'urlFormat'=>'path',
'rules'=>array(
'articles/<id:\d+>-<t:.+>'=>'articles/view',
// .......
),
),
),
);
But this project created another url like below:
articles/view&id=".$menu['items'][$itemId]['link'].
How to create SEO friendly url on this type link.
Summery
Same project create two type SEO friendly url
Thanks
Upvotes: 0
Views: 44
Reputation: 772
Try this,
"articles/view/<id:([a-zA-Z0-9$&,':=?|.^*()%~!-]+)>" => "articles/view",
and call url as /articles/view/id/1
Upvotes: 0