Hi, I’m really not sure if this kind of problem has already been covered here, as it seems that routing problems presented on this forum vary a lot and are generally quite complex - at least to me :D.
I’ve already achieved a solution that recognises a url like this: http://mysite.com/go/123 . But if the url contains more sub segments, I will get a 404 Page not found error.
There must be a better way I guess, but can you just do '$ObjectID!/$1/$2/$3/$4/$5/$6/$7/$8' => 'go' for as many params as you may need? $1 - $8 would be optional so that should let you have between 0 and 8 extra segments and still call the go method. That would only work of course if you have a concrete upper limit.
Thanks, I think this is the tradeoff that I will need to make, at least to make it work in the first place. I just need to define parameters up to something like $99 so that the upper limit is high enough. Not clean, but at least will work :). And if someone else comes up with a more elegant solution, I can then switch to that :).
Thank you for your suggestion. I think this would be a good solution in many cases. However, I need to support slashes in this particular case. To explain why, I will need to refine my above example uri in more detail:
I added www.example.com/ to the url. So the uri starts with the go part, after which there will be an ID number, and after that there will be a human readable url address to another website, where the controller will redirect the client’s web browser to after handling an action. To be honest, the www.example.com part and anything after it could be omitted from the url, because the ID number tells the controller where the user should be redirected to. I just want to include the www.example.com part in the url to give a hint to the user where they will end up if they click a link that has the url http://mysite.com/go/123/www.example.com/an/undefined/amount/of/url/segments.
If I would want to, I could convert the www.example.com url part to one query parameter, but I wouldn’t like it because the slashes of the url would not be so readable anymore: http://mysite.com/go/123?url=www.example.com%2Fan%2Fundefined%2Famount%2Fof%2Furl%2Fsegments