I am redirecting by this way. I think I'm wrong in this way please guide me better way.
<a href="<?php echo $this->serverUrl()."/restaurantlist/view/".$list['id']."/".$list['name']?>">
<img alt="" src="<?php echo $image; ?>">
</a>
my code of module.config.php
<?php
return array(
'controllers' => array(
'invokables' => array(
'Restaurantlist\Controller\Restaurantlist' => 'Restaurantlist\Controller\RestaurantlistController',
),
),
'router' => array(
'routes' => array(
'Restaurantlist' => array(
'type' => 'segment',
'options' => array(
// Change this to something specific to your module
'route' => '/restaurantlist[/]',
'defaults' => array(
'controller' => 'Restaurantlist\Controller\Restaurantlist',
'action' => 'list',
),
),
'may_terminate' => true,
'child_routes' => array(
'view' => array(
'type' => 'Segment',
'options' => array(
'route' => '[/]view[/:id][/:name][/]',
'constraints' => array(
'name' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[0-9]+',
),
'defaults' => array(
'controller' => 'Restaurantlist\Controller\Restaurantlist',
'action' => 'view',
),
),
),
),
),
),
),
'view_helpers' => array(
'factories' => array(
'Requesthelper' => function($sm){
$helper = new \Restaurantlist\View\Helper\Requesthelper;
$request = $sm->getServiceLocator()->get('Request');
$helper->setRequest($request);
return $helper;
}
)
),
'view_manager' => array(
'template_path_stack' => array(
'Restaurantlist' => __DIR__ . '/../view',
),
),
);
it is redirecting like this http://test.localhost.com/restaurantlist/view/157/Bluestem and works perfectly fine but I want this http://test.localhost.com/Bluestem or http://test.localhost.com/157-Bluestem
I tried a lot but no success.