Plus Sign In Urlmanager Path

Hi,

I am trying to set up a route which looks like url: acme.com/+username, where ‘username’ gets passed as a get variable to a controller action.

I have tried several syntax options and I cannot get the ‘+’ sign to work (it works with regular chars instead). For example:

‘+<username:.+>’ => ‘user/name’, - not working

‘\+<username:.+>’ => ‘user/name’, - not working

‘x<username:.+>’ => ‘user/name’, - working

How can I get ‘+username’ routed?

Thank you.

try this add w+


'customer/<controller:\w+>/<action:\w+>'=>'customer/<controller>/<action>',

Actually, I just figured it out.

The ‘+’ sign in an url gets translated to a ‘space’ (as a raw url encode), so the request never comes in containing the ‘+’ sign, but a space instead :)

you can create the url like…?


localhost/test/site/index/+id=1

Yes… you can, and it is valid. It just gets translated as "localhost/test/site/index/ id=1" (notice the space before id).