Tag Archives: Custom Route

Creating custom routes in your zend framework application

One of my zend framework project need to define custom routs . I have google a lot then found a solution.

Here I share my solution.

You can define custom routes in zend framework in many ways. I create a ini file to do this.

First add those line to your Bootstrap file.

protected function _initRoutes() {
$this->bootstrap('frontcontroller');
$front = Zend_Controller_Front::getInstance();
$router = $front->getRouter();
$myRoutes = new Zend_Config_Ini(APPLICATION_PATH . '/configs/routes.ini', 'production');
$router->addConfig($myRoutes, 'routes');
}

This will tell the system routing information from “routes.ini” file from application/configs.

Then you need a routes.ini file in application/configs. Now create a new file named routes.ini there.

Now say for example your domain is http://yourdomain.com and you want the http://yourdomain.com/index to be http://yourdomain.com/live Continue reading Creating custom routes in your zend framework application