社交引擎 4 用户配置文件重新路由


Social Engine 4 User profile rerouting

对于使用 Zend 框架的 Social Engine 4。我想在子域下显示用户配置文件。所以,http://domain.com/profile/username 会 http://username.domain.com

我该怎么做。我已经有一个扩展名,可以 http://domain.com/profile/username http://domain.com/username 这是它的代码。

$route = array(
        'user_profile' => array(
            'route' => ':id/*',
            'defaults' => array(
                'module' => 'user',
                'controller' => 'profile',
                'action' => 'index'
            ),
            'reqs' => array(
                'id' => "'b.+"
            )
        )
    );
Zend_Registry::get('Zend_Controller_Front')->getRouter()->addConfig(new Zend_Config($route));

是否可以将其更改为适用于子域?如果是,我该怎么做?

提前谢谢你。

        $hostnameRoute = new Zend_Controller_Router_Route_Hostname(
                                            ':id.'.$setting['siteurl'],
                                                    array(
                                                        'module' => 'user',
                                                        'controller' => 'profile',
                                                        'action' => 'index',
                                                    )
                                                );
        $plainPathRoute = new Zend_Controller_Router_Route_Static('');
        $router->addRoute('user_profile', $hostnameRoute->chain($plainPathRoute));