The rule should be (to remove an additional city, which is the name of the GET parameter):
'<controller:\w+>/<action:\w+>/<city:\w+>'=>'<controller>/<action>', // not city:\d, since Delhi is a string, not digit
Thus, the rule should match the parameter name, if you have foo / Delhi, you would use <foo:\w+> .
And to delete ? use appendParams of CUrlManager , (in your urlManager config):
'urlManager'=>array( 'urlFormat'=>'path', 'appendParams'=>true,
When appendParams
true, GET parameters will be added to the path information and separated by a slash.
Update: if you have more than one parameter passed to the ie action:
http://localhost/nbnd/search/manualsearch/Delhi?tosearch=restaurants
Use /* at the end of the rule:
'<controller:\w+>/<action:\w+>/<city:\w+>/*'=>'<controller>/<action>'
Get form urls:
http://localhost/nbnd/search/manualsearch/Delhi/tosearch/restaurants
source share