Urlmanager Rule Order

Hi guys,

I have 2 controller called ‘post’ and ‘category’. Both controller have the ‘create’ action.

The ‘create’ action in ‘review’ controller requires parameters while ‘create’ action in ‘category’ controller does not require any parameter.

I have 2 rules in my urlManager

'<controller:\w+>/add/<id:\d+>/<slug:[a-zA-Z0-9-]+>/' => '<controller>/create',

'<controller:\w+>/add/' => '<controller>/create',

Whenever I access /test-app/review/add/1/test-abcdefg, see ‘create’ action view. However, whenever I access localhost/testapp/category/add, it would hit an error and say request invalid.

What is the rationale behind this and is there any typical precedence on how rules should be placed? Thanks.

That has nothing to do with url manager rules, just add a default value in the action parameter. That will make it optional.