tak jak w temacie potrzebuje napisać router aby przekierowywał mnie na konkretny moduł. Chodzi, że jak wbijam na test.domen.pl to uruchamia mi się moduł test.
W obecnej chwili mam napisane coś takiego w application/bootstrap.php
public function _initRoute() { $this->bootstrap('frontcontroller'); $frontController = $this->getResource('frontcontroller'); $router = $frontController->getRouter(); $router->removeDefaultRoutes(); $router->addRoute( 'langmodcontrolleraction', new Zend_Controller_Router_Route('/:lang/:module/:controller/:action/*') ); $router->addRoute( 'langmodulecontroller', new Zend_Controller_Router_Route( ) ); $router->addRoute( 'langmodule', new Zend_Controller_Router_Route( ) ); $hostnameRoute = new Zend_Controller_Router_Route_Hostname( ) ); $normalRoute = new Zend_Controller_Router_Route( ) ); $router->addRoute('default', $hostnameRoute->chain($normalRoute)); $router->addConfig(new Zend_Config_Ini(APPLICATION_PATH . '/configs/routes.ini'), 'routes'); }
Próbowałem jeszcze zrobić coś takiego ale to też nie działa.
config/routers.ini
resources.router.routes.subdomain.type = "Zend_Controller_Router_Route_Hostname" resources.router.routes.subdomain.route = ":test.example.com" resources.router.routes.subdomain.defaults.module = "test" resources.router.routes.subdomain.chains.index.type = "Zend_Controller_Router_Route" resources.router.routes.subdomain.chains.index.route = "/:lang/:controller/:action/*" resources.router.routes.subdomain.chains.index.defaults.controller = "index" resources.router.routes.subdomain.chains.index.defaults.action = "index"
No i to nie działa. Bo dostaje cały czas 500 :/ Proszę o pomoc.
dodam jeszcze żeby nie było, że jestem debilem ale zmieniłem vhosty na lokalu tak jak być powinno. I hosty działają tylko nie ładuje zawartości modułu.
Dobra wszystko działa. Jak by ktoś kiedyś potrzebował rozwiązania to podaje. W moim przypadku to pomoglo
$hostnameRoute = new Zend_Controller_Router_Route_Hostname( ); $plainPathRoute = new Zend_Controller_Router_Route_Static(''); $router->addRoute('test', $hostnameRoute->chain($plainPathRoute));