简体   繁体   中英

How to prevent a route from being accessed via its associated module/controller/action path in Zend Framework?

Let's say I create a route:

$account_route = new Zend_Controller_Router_Route_Static(
    'account',
    array(
        'module'     => 'user',
        'controller' => 'account',
        'action'     => 'edit',
    )
);

Now this page can be visited via example.com/account , AND example.com/user/account/edit .

I'd like to create one point of entry for all my pages for SEO purposes and to prevent users from trying to figure out how my app is architected on the server. Is there a way to return a 404 to anyone who tries to access a URL through the module/controller/action pattern for where a designated route exists?

您可以覆盖默认路由或将其删除:

$router->removeDefaultRoutes();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM