Search code examples
zend-frameworkprefixspecial-folders

Prefix Folder structure for Zend


If i have a url such as this http://example.com/controller/action every thing works find. as expected. However i need to deploy this and in deployment things change a bit to htttp://deploy.com/stuff/pile/controller/action is there any way i can control this in zend.

Thanks in advance.


Solution

  • Add this route to your Bootstrap:

    protected function _initRoute() {
        $front = Zend_Controller_Front::getInstance();
        $router = $front->getRouter();
        $router->addRoute(
            'prefix_route',
            new Zend_Controller_Router_Route('stuff/pile/:controller/:action',
                array('controller' => $front->getRequest()->getControllerName(),
                      'action' => $front->getRequest()->getActionName())));
        );
    }