I would like to use Zend_Controller_Router_Rewrite to rewrite my URL ndd.dev/interet/index/id/1/ for ndd.dev/i/rouen/1/ with zend 1.12
For this I have add in my bootstrap :
protected function _initRouter () {
$config = new Zend_Config_Ini(APPLICATION_PATH.'/config/application.ini', APPLICATION_ENV);
$router = new Zend_Controller_Router_Rewrite();
$router->addConfig($config, 'routes');
}
into my "application.ini" :
routes.interet.type = "Zend_Controller_Router_Route_Regex"
routes.interet.route = "/i/(.+)/([0-9]+)/"
routes.interet.defaults.controller = "interet"
routes.interet.defaults.action = "index"
routes.interet.map.1 = "seo"
routes.interet.map.2 = "id"
routes.interet.reverse ="i/%s/%d/"
my .htaccess :
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
But www.ndd.dev/i/rouen/1/ returns :
Zend_Controller_Dispatcher_Exception Invalid controller specified (i) envoyée dans /www/library/Zend/Controller/Dispatcher/Standard.php à la ligne 248
have I forgoten smoething like addRoute or something else ?
I've tried this method in my bootstrap:
$router = Zend_Controller_Front::getInstance()->getRouter();
$r = new Zend_Controller_Router_Route_Regex(
"/i/([-\w]+)/(\d+)/",
array('controller' => 'interet', 'action' => 'index'),
array(1 => 'seo', 2 => 'id'),
'i/%s/%d/'
);
$router->addRoute('interet', $r);
and same result, he tries to found "i" controler
*Zend_Controller_Dispatcher_Exception Invalid controller specified (i)*
Thanks