ルーターは、コントローラーとアクションの定義の前にカスタム パラメーターを定義します。
Router::connect(
'/:store/:controller/:action/*',
array(),
array(
'store' => 'shop\/[^\/]+'
)
);
Router::mapResources('Invoices');
Router::parseExtensions();
「/shop/x」で始まるリクエストに一致します。ここで、x は ID です。
http://host.com/shop/1/invoices/view/1
ただし、上記の定義は REST リクエストを適切にルーティングしません。
http://host.com/shop/1/invoices/1.json (doesn't work)
回避策として、アクションを渡すことで機能します (ただし、これは REST には理想的ではありません)。
http://host.com/shop/1/invoices/view/1.json
残りのルートを機能させる方法についてのアイデアはありますか?