Hello folks,
Here I am trying to route a page without showing its action in URL,
Eg: URL is http://localhost/brands/1/xyz
Router::connect(
'/brands/:id/:name',
array(
'controller' => 'brands',
'action' => 'index',
'id' => '[0-9]{1,}',
'name' => '[a-z]{1,}'
)
);
it works fine....
But I need to make the id
and name
as optional and tried this:
Router::connect(
'/brands/:id/:name',
array(
'controller' => 'brands',
'action' => 'index',
'id' => '[0-9]{1,}',
'name' => '[a-z]{1,}'
)
);
according to http://book.cakephp.org/view/542/Defining-Routes
But when I try this URL http://localhost/brands/1
it searches for action 1 but http://localhost/brands/1/xyz
works fine.
Is there any mistake in my routing configuration????