0

For Social Engine 4, which uses Zend framework. I want to show user profiles under subdomains. so, http://domain.com/profile/username will be http://username.domain.com

How can I do this. I do already have one extension which makes http://domain.com/profile/username to http://domain.com/username Here is the code for it.

$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));

Is it possible to change it to work for subdomains? If yes how can I do it?

Thank You in advance.

TheGodWings
  • 163
  • 1
  • 3
  • 12

1 Answers1

0
        $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));
TheGodWings
  • 163
  • 1
  • 3
  • 12