Shaani
(Aziz Zee)
1
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
rookie84
(Lifeline Is)
2
This should fix it:
In URL Manager rules:
‘site/detail/<rescom>/<salerent>/<code:\d{4}>’=>‘site/detail’,
shailesh
(Shailesh Makwana990)
3
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
Shaani
(Aziz Zee)
4
This didn’t work. Do I need to make changes to some file of apache ?
Shaani
(Aziz Zee)
5
The comment is not there. I had removed it
rookie84
(Lifeline Is)
6
'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