Reputation: 1911
I want to configure custom URL in Yii . I am stuck at one last step . This is how I create the URL :
$a->url = Yii::app()->createUrl('view/profile',array('uid'=>$a->userid,'type'=>$a->type,'specialty'=>$specialty,'locality'=>$locality)) ;
This is how I have the rule in config file :
'profile<uid:\w+>_<type:\w+>/'=>'view/profile,
This works fine except that the URL which is generated is :
http://localhost/dev/profile122_doctor?specialty=Cardiology&locality=Times+Square
I want the URL to be cleaner , something along these lines :
http://localhost/dev/profile122_doctor/specialty-Cardiology-near-Times-Square
Can this be done ? Any suggestions ? Btw only uid and type variables are actually required for the URL to work correctly . Rest of the info is needed for the purpose of SEO .
Upvotes: 0
Views: 1807
Reputation: 8950
You could define your own URL Rule class, this way you'll have more liberty on the syntax:
Using Custom URL Rule Classes in Yii
Upvotes: 2