开发者

ZF Route how to avoid overide?

开发者 https://www.devze.com 2022-12-08 18:47 出处:网络
I have, I believe, a simple problem, but I don\'t know how to solve it... So, I have the standard app with default and admin module. And I need some SEO friendly urls.

I have, I believe, a simple problem, but I don't know how to solve it... So, I have the standard app with default and admin module. And I need some SEO friendly urls.

In admin module I want to use standard urls like /admin/controller/action but I am killing this when I add the following code in my bootstrap file...

    $model_info = new Zend_Controller_Router_Route开发者_如何学C(
        '/:id/:manufacturer/:model_name',
        array(
            'module' => 'default',
            'controller' => 'index',
            'action'     => 'modelinfo'
        )
    );
   $router->addRoute('model_info',$model_info);

The result of this is that I have nice urls which are working but know I can't access any action, from any controller in admin module...

My question is how to define this route or how to add new one, so I can access my admin module "normally" and have "front end" urls like this?


You could add another route for the admin after that. Something like:

$admin_route = new Zend_Controller_Router_Route(
    '/admin/:controller/:action',
    array(
        'module' => 'admin',
    )
);


What I tend to do in cases like this is to have my custom routes in a separate root for example:

/routes/:id/:manufacturer/:model_name

That way I don't mess up the other default routes.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号