shlumph Posted August 22, 2009 Share Posted August 22, 2009 I am having some trouble creating dynamic subdomains. The idea is to route the following URL: asdf.budget.com to www.budget.com/test/index/asdf I have setup a Controller Plugin: <?php class Rob_Controller_Plugin_Route extends Zend_Controller_Plugin_Abstract { public function routeStartup(Zend_Controller_Request_Abstract $request) { //http://framework.zend.com/manual/en/zend.controller.router.html#zend.controller.router.routes.hostname //http://www.noginn.com/2008/09/03/using-subdomains-as-account-keys/ $front = Zend_Controller_Front::getInstance(); $router = $front->getRouter(); $router->removeDefaultRoutes(); $pathRoute = new Zend_Controller_Router_Route( ':controller/:action/*', array( 'controller' => 'index', 'action' => 'index' ) ); $adminRoute = new Zend_Controller_Router_Route_Hostname( ':test.budget.com', array( 'controller' => 'test', 'action' => 'index' ) ); $router->addRoute('test', $adminRoute->chain($pathRoute)); $defaultRoute = new Zend_Controller_Router_Route_Hostname( 'www.budget.com', array( 'module' => 'default', ) ); $router->addRoute('default', $defaultRoute->chain($pathRoute)); } } And connect it in my applications.ini file: resources.frontController.plugins.Route = "Rob_Controller_Plugin_Route"; However, it's not routing to the test controller and index action when I enter in a subdomain. Anyone see what's wrong here? Any help is greatly appreciated. Link to comment https://forums.phpfreaks.com/topic/171442-dynamic-subdomains-zend_controller_router_route_hostname/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.