I'm using Zend, and here is my problem, i have two different urls that i really want to keep like they are.
i want url : "www.urlA.com" to be directed to application/moduleA/indexController/indexAction and "www.urlB.com" to application/index/index.
In other words, i want Zend_Router to make sure that when i type www.urlA.com/index/login i use the application/moduleA/ Index controller and loginAction().
I want to keep the classic Zend routing, just adding the fact that my module is already specified in the url.
I have the following code int the bootstrap:
protected function _initRouter()
{
$router = Zend_Controller_Front::getInstance()->getRouter();
$route = new Zend_Controller_Router_Route_Hostname(
'www.urlA.com',
array(
'module'=>'moduleA'
)
);
$routeURI = new Zend_Controller_Router_Route();
$router->addRoute('modulea', $route->chain($routeURI));
}
This way with the "urlA" i correctly go to moduleA/index/index but
"urlA/index/login" doesn't work.
Thanks for any help.
I had a similar problem once and I wrote this :
//ADMIN page
$admin = array('module' => 'admin', 'controller' => 'index', 'action' => 'index');
$hostRoute_admin = new Zend_Controller_Router_Route_Hostname('admin.mysite.com', $admin);
//special environement Website
$env = array('module' => 'env', 'controller' => 'index', 'action' => 'index');
$hostRoute_env = new Zend_Controller_Router_Route_Hostname('env.mysite.com', $env);
//Zend classic routing
$plainPathRoute = new Zend_Controller_Router_Route(':controller/:action/*',
array('controller' => 'index', 'action' => 'index'));
//add specific routing
Zend_Controller_Front::getInstance()->getRouter()->addRoute('admin', $hostRoute_admin->chain($plainPathRoute));
Zend_Controller_Front::getInstance()->getRouter()->addRoute('env', $hostRoute_env->chain($plainPathRoute));