Url Parsing And Createurl

Hey Guys, My config looks like this:





                    'rules'=>array(

                        '<controller:\w+>/<id:\d+>/<action:\w+>(/<subId:\d+>)?' => '<controller>/<action>',

                        '<controller:\w+>/<id:\d+>/(.*)?' => '<controller>/view',

                    ),



This allows me to do some things like

/user/23/throw/this/data/away/for/seo

and things like

/user/23/book/24

and it works for incoming requests. But when I do the following:




// CGridView

	    array(

	       'class'=>'CLinkColumn',

	       'labelExpression'=>'$data->domain',

	       'urlExpression'=>'Yii::app()->createUrl("sites/view",array("id"=>$data->id))',

	       'header'=>'Domain'

	    ),



I get: http://192.168.1.103/index.php/sites/1/(.*)?

So this is probably something that I’ve done wrong. Any thoughts to help a guy out? Or should I start building my own slugs. i.e

$data->slug

public function getSlug(){

// build slug

}

Couldn’t the second rule just be this?




'<controller:\w+>/<id:\d+>.*' => '<controller>/view',



I’m not sure whether it helps with your problem though.

Thanks for your Reply, and so close! With the .* it includes the period in the numeric integer so the parsing fails, but this works.




        '<controller:\w+>/<id:\d+>*' => '<controller>/view',



Which isn’t exactly valid regex I think? But I’m happy to have it work.