Not sure how you would solve the first example, I’m still learning myself this myself.
But let’s assume you have an advanced pattern/rule in place, set to solve your first routing. Then to solve the other ‘problem’ it’s really easy.
The URL is parsed through the rules until it comes across the first one that matches. So, it would something like this:
'showScriptName' => false,
'advanced rule'=>'that I dont know how to set',
That way, when you supply an URL like serverdomain/controller/create it will match the first rule. Second with update, and the more advanced rule down there at third place wont kick in.
Now all you have to do is figure out the advanced rule. Good luck!
Ok so I’ve toyed around with this for exercising reasons, and I’ve found one pattern that works like you want. I have no idea why you’d want it set up like that though, I’ll give you that
May require some extra testing, but I know for a fact that when I try the third rule out with serverdomain/controller/abc/xyz/123/ and var_dump my $_GET’s, I have:
‘target’ => string ‘/abc/xyz/123’ (length=12)
To explain the rule a bit:
‘controller’ at start matches the word controller.
/* basically means “any amount of parameters afterwards”. I had to put this in since we can’t treat /abc/xyz/123 as ONE parameter.
Which is actually what we do anyway inside the gt/lt tags:
Here we say that what comes next is a GET parameter we want to name ‘target’. And the part to the right of the colon : is REGEXP. I didn’t know this from the start that this part was suppose to be regexp. Yet, it says so in the API reference, so checking there is fruitful at times! Try it!
So, once again:
The right part here is a simple regexp that matches basically: