how to change default module in Zend 2

421 Views Asked by At

I am new to ZendFeamerwork version 2. I could easily change the default controller in Zend1 but it seems very difficult to me to find out how to change default module in Zend2.

I searched over google but there is no easy solution.

I just created a module named "CsnUser" I can access this module via the following url

http://localhost/zcrud/public/csn-user/

I want csn-user to load instead of "application" module i.e url should be

http://localhost/zcrud/public/

or

http://localhost/zcrud/

Please let me know how to get this done.

1

There are 1 best solutions below

0
On

Based on @Hoolis comment:

You have to set that action on this route

'home' => array(
    'type' => 'Literal',
        'options' => array(
            'route'    => '/',
            'defaults' => array(
                'controller' => 'That\Namespace\CsnUser',
                'action'     => 'index'
            )
        )
    )
)

In the skeleton application this route is set in the Application Module, but you can move this somewhere or edit it.