<?php
return array(
'controllers' => array(
'invokables' => array(
'Member\Controller\Member' => 'Member\Controller\MemberController',
),
),
'router' => array(
'routes' => array(
'member' => array(
'type' => 'Zend\Mvc\Router\Http\Literal',
'options' => array(
'route' => '/',
'defaults' => array(
'controller' => 'Member\Controller\Member',
'action' => 'index',
),
),
),
'member' => array(
'type' => 'segment',
'options' => array(
'route' => '[/:action][/:pkMemberId][/:status]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'pkMemberId' => '[0-9]+',
'status' => '[0-9]+',
),
'defaults' => array(
'controller' => 'Member\Controller\Member',
'action' => 'index',
),
),
),
'changeMemberPassword' => array(
'type' => 'segment',
'options' => array(
'route' => '/changeMemberPassword',
'defaults' => array(
'controller' => 'Member\Controller\Member',
'action' => 'changePassword',
),
),
),
),
),
'service_manager' => array(
'abstract_factories' => array(
'Zend\Cache\Service\StorageCacheAbstractServiceFactory',
'Zend\Log\LoggerAbstractServiceFactory',
),
'aliases' => array(
'translator' => 'MvcTranslator',
),
),
'translator' => array(
'locale' => 'en_US',
'translation_file_patterns' => array(
array(
'type' => 'gettext',
'base_dir' => __DIR__ . '/../language',
'pattern' => '%s.mo',
),
),
),
);
?>
i have a route like this http://www.abc.com/member-profile/756 but i want to show it like this http://www.abc.com/john. showing user first name in the url. Thanks
If you want to use firstname in url by hiding module and action from url, you can do this by add routing as below:
You need to call this by adding this line:
you need to use a unique/distinct first name for every member to identify the user or provide an id in parameter to identify the member.