Urlmanager Help Me

I have 2 modules in my applications: admin and customer.

My goal is to use SEO friendly URL to call all the views of my application.

For example: /customer/restaurant/view/34/My+Shop

If I use this simple code in all my webpages it works fine:

CController::createUrl(‘customer/restaurant/view’,array(‘id’=>$this->id,‘title’=>$this->title));

but unfortunately in all my web pages I have this code

Controller::createUrl(‘restaurant/view’,array(‘id’=>$this->id,‘title’=>$this->title));

Actually my URL MANAGER settings are the following:

	'urlManager'=>array(


		'urlFormat'=>'path',


		//'showScriptName'=>true,


		'showScriptName'=>false,


		'rules'=>array(	


							


                '<controller:\w+>/<action:\w+>/<id:\d+>/<title:.*?>' => '<controller>/<action>',                   


			


	),

Can you please help me to understand how to set URL MANAGER??

something like

‘/customer/restaurant/view/<id:\d+>/<title:\w+>’ => ‘restaurant/view’

public function actionView($id, $title)

{

}

I’ve tried to add your rule to my URL MANAGER

‘urlManager’=>array(

'urlFormat'=&gt;'path',


'showScriptName'=&gt;false,


'rules'=&gt;array(


   '/customer/restaurant/view/&lt;id:&#092;d+&gt;/&lt;title:&#092;w+&gt;' =&gt; 'restaurant/view',			


   '&lt;controller:&#092;w+&gt;/&lt;action:&#092;w+&gt;'	    =&gt; '&lt;controller&gt;/&lt;action&gt;',   


 ),

),

The address is displayed corretly (//localhost/myapp/customer/restaurant/view/34/My+Shop) on the source page, but once I click on the link there is a problem on the destination page: "404 error: Page not found"

Thanks.

paste your action code.

regular-expressions.info/shorthand.html:

Try this (I added the space char to the character class):


'/customer/restaurant/view/<id:\d+>/<title:[\w ]+>' => 'restaurant/view',

Dear all,

I found the solution.

It was a double problem:

  1. routing the requests to customer module

  2. decoding SEO friendly url

These are my settings for URL MANAGER.

//ROUTING LINE

‘restaurant/<action>/*’ => ‘customer/restaurant/<action>’,

//DECODING SEO FRIENDLY URL

‘<controller:\w+>/<action:\w+>/<title:.*?>’ => ‘<controller>/<action>’,

‘<controller:\w+>/<action:\w+>’ => ‘<controller>/<action>’,

Thank you all for your help.