Reputation: 15706
I am writing a user registration form.
After the user registers with a username e.g. "Billy", I would like him to use the url billy.mydomain.com to access the server.
The Zend framework link of billy.mydomain.com is
www.mydomain.com/profile/index/username/billy
I would like to know how I can rewrite the url from
www.mydomain.com/profile/index/username/billy
to
billy.mydomain.com
Upvotes: 0
Views: 274
Reputation: 106372
Throwing away my initial answer, This Solution is much more elegant.
$hostnameRoute = new Zend_Controller_Router_Route_Hostname(
':username.mydomain.com',
array(
'controller' => 'profile',
)
);
$pathRoute = new Zend_Controller_Router_Route(":action/*", array( 'action'=>'index' ));
$chain = $hostnameRoute->chain($pathRoute);
// add $chain to your router
Upvotes: 3