0

i am trying to make my router working so that:

/Auth redirects to Auth controller of Auth MOdule
/Auth/Login redirects to Login controller of Auth Module

While the first works just right the /Auth/Login results in routing issue.

My router configuration file looks like below:

     'router' => array(
     'routes' => array(
         'Auth' => array(

             'type' => 'literal',
             'options' => array(
                 'route'    => '/Auth',
                 'defaults' => array(
                     'controller' => 'Auth\Controller\Auth',
                     'action'     => 'index',
                    ),
                ),
                'may_terminate' => true,
                'child_routes' => array(
                    'Auth/Login' => array(
                        'type' => 'literal',
                        'options' => array(
                            'route' => '/Login',
                            'defaults' => array(
                                'controller' => 'Auth\Controller\Login',
                                'action' => 'index')
                    ),
                ),
            ),
         ),
     ),
 ),
Wilt
  • 41,477
  • 12
  • 152
  • 203
Abdel5
  • 1,112
  • 3
  • 16
  • 39
  • 3
    Code looks okay, although you probably don't want the `/` in the login route name (just called it `Login` rather than `Auth/Login`). What is the routing error that you get? – Tim Fountain May 25 '15 at 19:54

2 Answers2

0

The answer lies in @TimFountain his comment. Because you named the child route Auth/Login you will have to request Auth/Auth/Login to get a match.

As soon as you rename the child route to Login you will get the route match as expected on Auth/Login.

Wilt
  • 41,477
  • 12
  • 152
  • 203
0

edit this section

   'child_routes' => array(
        'Auth_Login' => array(
           // ... your existing codes 

Just remove / from Auth/Login and use hyphen - or _ instead.

Malay M
  • 1,659
  • 1
  • 14
  • 22