Hi, I’m working on one application where we need to have some custom url with these examples.
mydomain.com/toronto/free-wifi-restaurants.htm
parameters =toronto, free-wifi
mydomain.com/toronto/sushi-restaurants.htm
parameters =toronto, sushi
mydomain.com/toronto/downtown-restaurants.htm
parameters =toronto, downtown
in my config.php files
$retval=array(
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
'urlSuffix'=>'.htm',
'rules'=>require(dirname(__FILE__).DIRECTORY_SEPARATOR.'routes.php'),
),
)
in my routes.php file
$retval=array(
'<cityAlias:.*?>-<featureAlias:.*?>-restaurants'=>'restaurants/showByFeatures',
'<cityAlias:.*?>-<foodAlias:.*?>-restaurants/'=>'restaurants/showByFoods',
'<cityAlias:.*?>-<areaAlias:.*?>-restaurants'=>'restaurants/showByArea',
)
in my view.php file
$retval=array(
<?php echo CHtml::link('Free Wi-Fi', array('restaurants/showByFeatures','cityAlias'=>'toronto', 'featureAlias'=>'free-wifi'));?>
<?php echo CHtml::link('Sushi', array('restaurants/showByFoods','cityAlias'=>'toronto', 'foodAlias'=>'Sushi'));?>
<?php echo CHtml::link('Free Wi-Fi', array('restaurants/showByFeatures','cityAlias'=>'toronto', 'areaAlias'=>'downtown'));?>
)
My problem is if I keep all above url routes together then some of them get route to wrong controller/action but if I remove two and keep one then it works as we per result.
Any idea where we doing mistake and some alternate for this task.
I look forward to hear from you guys,
Jan