Passing Varchar In URL

Hi All,

i need your help in passing a varchar in URL in-place of id

This is my UrlManager rule i am using

     '<module:media>/<id:\d+>' => '<module>/default/view',

and when i am passing my URL as

localhost/media/23trt4 i am getting error saying "The system is unable to find the requested action"

Rule, i have written works fine for "int values". But when i am sending as varchar, i am not able to get that. Can anyone help me to fix this issue??

in the part "[color=#1C2837][size=2]<id:\d+>" the \d+ means decimal… try with \w instead[/size][/color]



[color=#1C2837][size=2]also check the documentation regarding the regex syntax - [/size][/color][color="#1c2837"][size=2][/size][/color]

thanks, its working fine now. I was trying with "<action: \w+>".

you don’t need +…

\d means one digit so + is needed with it to allow a number with more digits…

while \w means one word… with a + it would mean more words.

again check the doc for this here -


\w should mean a character that can be used in "word".