In your module.config.php
'router' => array(
'routes' => array(
'news' => array(
'type' => 'Zend\Mvc\Router\Http\Segment',
'options' => array(
'route' => '[/:news][/:url][/]',
'constraints' => array(
'url' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
'defaults' => array(
'__NAMESPACE__' => 'YourModule\Controller',
'controller' => 'News',
'action' => 'index',
),
),
),
),
),
if you choose to use text instead of Id you have to be sure that url is unique otherwise your application will sever the first match.
in the example you added:
url = 'man-dies-after-burning-himself'
This will cover:
- example.com/news/man-dies-after-burning-himself
- example.com/news/man-dies-after-burning-himself-2015-07-07
- example.com/news/man
- example.com/news/2015-07-07 .....