cakePHP - how to ovveride the default routing?
I have a controller, and I have several aliases for a single function in it. eg:
Router::connect(
'/controllerX/:method',
array('controller' => 'controllerX', 'action' => 'bigApple'),
array('method'=>'help|ask|read', pass => array(method))
);
Now, for some reason(don't ask..) I want to keep the original methods in the controller, but I don't want them to be available for direct access.
Meaning: in the controller there will be functions named: ask
,help
, and read
, but they won't be accessible for direct call.
/controllerX/ask
, or /controllerX/help
, i want him to be routed to somewhere else.
is it possib开发者_如何学运维le at all? (it seems like an endless loop..)
I think in your case, you have to do a check before and redirect to Controller:: setAction
Checkout: http://api.cakephp.org/class/controller#method-ControllersetAction
精彩评论