Problem generating clean URL

In main.php file I have this code


'urlManager'=>array(

			'urlFormat'=>'path',

			'rules'=>array(

				'site/rescom/salerent/<code:\d{4}>'=>'<controller>/<action>',

I use this code in my index.php file




<?php echo $this->createUrl('site/detail',array('rescom'=>'residential', 'salerent'=>'sales', 'code'=>$mod->code)); ?>




the link I get is


http://localhost/mysite/index.php/site/detail?rescom=residential&salerent=sales&code=1307

but I need a format like this


http://localhost/mysite/index.php/site/detail/residential{or commercial}/sales{ or rent}/1307{any 4 digit code}

I don’t want ?rescom= &salerent= and &code= in the generated url

This should fix it:

In URL Manager rules:

‘site/detail/<rescom>/<salerent>/<code:\d{4}>’=>‘site/detail’,

Hi,

Code In View Is Correct

<?php echo $this->createUrl(‘site/detail’,array(‘rescom’=>‘residential’, ‘salerent’=>‘sales’, ‘code’=>$mod->code)); ?>

You just Need To change UrlManager in Main.php where you can specify the Regex for Custom URL

Just Remove ‘UrlManager’ Comment And Code work Fine

Regards,

Shailesh makwana

This didn’t work. Do I need to make changes to some file of apache ?

The comment is not there. I had removed it


		'urlManager'=>array(

			'urlFormat'=>'path',

			'rules'=>array(

                                 'site/detail/<rescom>/<salerent>/<code:\d{4}>'=>'site/detail', 

This works for me…

Paste your config file, and .htaccess and the error or URL you see in browser