The rules are specified as an array of pattern-route pairs, each corresponding to a single rule. The pattern of a rule must be a valid regular expression without delimiters and modifiers. It is used to match the path info part of URLs. And the route should refer to a valid controller route.
so I understand I can specify a regex in the pattern part of a rule and if my request matches this pattern the route part of the rule will be used as route.
but
in my app I have a rule like this :
'[a-z]+' => 'site/index'
which translates internally into /^[a-z]$/
which should match a request like
/myrequest
which should use 'site/index' as route
I debugged a little (followed the request) and there is is this part in CurlManager :
First, you are not reporting any problem in this problem, right?
The line of the code is to preclude most of the URL rules based on the current pathinfo and the signature of each rule. This is mainly for performance improvement. You can ignore this line in the first read.
I guess as a follow up to the controller/action placeholders maybe it would be a nice addition (if this is doable) to be able to do this, and maybe to have the possibility to use regex subexpressions to be replaced in the route
like
'(['a-z']+)/<id:\d+>' => '$1/read' //reach any controller read action
or
'admin/(['a-z']+)/' => 'admin/$1/admin' //reach any admin module controller admin action
don't know if this makes sense
anyway
I thought the guide was a bit misleading in the sense that it says that a pattern is a regex
I guess as a follow up to the controller/action placeholders maybe it would be a nice addition (if this is doable) to be able to do this, and maybe to have the possibility to use regex subexpressions to be replaced in the route
like
'(['a-z']+)/<id:\d+>' => '$1/read' //reach any controller read action
or
'admin/(['a-z']+)/' => 'admin/$1/admin' //reach any admin module controller admin action
don't know if this makes sense
anyway
I thought the guide was a bit misleading in the sense that it says that a pattern is a regex
thanks for your time !
I'm looking for exactly this functionallity. Something like this: