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?
try this add w+
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…?
Yes… you can, and it is valid. It just gets translated as "localhost/test/site/index/ id=1" (notice the space before id).