The Route /ctl/act/subact/:mode/:sort
means that there must be a :mode
and :sort
parameter. This route would not match the URL /ctl/act/subact/
. If there are optional parameters, you need to denote those with an asterisk: /ctl/act/subact/*
. This route would match the URLs /ctl/act/subact/
, /ctl/act/subact/foo
and /ctl/act/subact/foo/bar
.
If you need these optional parameters as named parameters, you'll need to create several routes for each possible "length":
Router::connect('/ctl/act/subact/:mode/:sort', array('controller' => 'ctl', 'action' => 'act_subact', 'mode' => null, 'sort' => null));
Router::connect('/ctl/act/subact/:mode', array('controller' => 'ctl', 'action' => 'act_subact', 'mode' => null));
Router::connect('/ctl/act/subact/', array('controller' => 'ctl', 'action' => 'act_subact'));