Reputation: 1790
i have url like
localhost/abc.com/info/c/q/Best%20Men
here info is the controller and c is action and q is query id.
i want to re write these url dynamically by removing c/q/ and using non space url. For instance like this
localhost/abc.com/info/Best_Men
is it possible using urmanager???
i tried this code but it didnt work
'info/c/<q:\d+>'=>'info/<q:\d+>',
[AFTER EDIT]
My config contained this
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
'caseSensitive'=>false,
'urlSuffix'=>'.html',
'urlFormat'=>'path',
'rules'=>array(
'info/<q:\w+>' => 'info/c'
),
),
For more explaination here is what are my urls
http://localhost/abc.com/mycontroller/myactionsearch?q=Best
it returns me lists of searched items and on clicking any link it opens for e.g. clicking best men open this below link
http://localhost/abc.com/mycontroller/myactionItem/q/Best%20Men
so actually i have two different actions within same controller and now i want to make it run like
http://localhost/abc.com/mycontroller/Best%20Men
or
http://localhost/abc.com/mycontroller/myactionItem/Best%20Men
but it gives page not found error using above config
Upvotes: 0
Views: 631
Reputation: 437734
That route is wrong for several reasons:
\d
means "digit", so it won't match "Best_Men")Instead of this you want something more similar to
'info/<q:\w+>' => 'info/c'
Upvotes: 1