通过子域(主机名)进行ZF2路由

时间:2015-06-29 08:20:37

标签: zend-framework zend-framework2

我在myhost.com上添加了一个子域名:reseller.myhost.com,我希望它能够路由到我的经销商'模块。我读到了这个问题:zend-framework-2-routing-subdomains-to-module

我的转销商路由是:

   //Routing of User
'router' => array(
    'routes' => array(


        'Reseller' => array(
            'type'    => 'Hostname',
            'options' => array(
                'route'    => 'reseller.myhost.com',
                'constraints' => array(

                ),
                'defaults' => array(
                    'controller' => 'Reseller\Controller\Reseller',
                    'action'     => 'index',
                ),
            ),
            'may_terminate' => true,

            'child_routes' => array(
                'login' => array(
                    'type' => 'Zend\Mvc\Router\Http\Literal',
                    'options' => array(
                        'route'    => '/login',
                        'defaults' => array(
                            'action'     => 'login',
                        ),
                    ),
                ),
                'createAd' => array(
                    'type' => 'Zend\Mvc\Router\Http\Literal',
                    'options' => array(
                        'route'    => '/createAd',
                        'defaults' => array(
                            'action'     => 'createAd',
                        ),
                    ),
                ),


            ),
        )
    ))

我希望它转到Reseller索引操作,但它转到Application的索引操作。我该怎么办?

如果我访问url reseller.myhost.com/login一切正常,但如果我致电reseller.myhost.com,则会转到应用程序模块的索引。

0 个答案:

没有答案