I
I
Ilya Lesnykh2014-05-12 18:52:11
Zend Framework
Ilya Lesnykh, 2014-05-12 18:52:11

How can I use the same ZF2 instance for different projects?

I have a need to make a couple of pages on the site domain.ltd and a couple on sub.domain.ltd. For this I want to use the same ZF2 instance.
As I understand it, the sub subdomain has its own index.php, in which the config connection paths have been tweaked. The question is how to specify at this entry point that a different module is used (the separation would be done at the module level). Maybe I'm digging in the wrong direction at all?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
yvm, 2014-06-05
@yvm

You can use the hostname route, like so:

'router' => array(
        'routes' => array(
            'control' => array(
                'type' => 'hostname',
                'options' => array(
                    'route' => '[:sub.]domain.ltd',
                    'defaults' => array(
                        'controller' => 'Control\Controller\Index',
                        'action' => 'index',
                        'sub' => 'www',
                    ),
                ),
           ),
      ),

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question