Zend, enrutamiento de URL, URL 404 con parámetros no identificados o desconocidos

I a large number of routes in zend with various parameters. I need to throw a 404 if the url has 1. invalid params 2. unknown params

for instance, I have the following url

http://www.example.com/something/1

con ruta

'client'    => array(
    'type'          => 'Zend_Controller_Router_Route',
    'route'         => '/:alias/:page',
    'defaults'      => array('module' => 'client', 'controller' => 'index', 'action' => 'details', 'alias' => false, 'page' => 1),
),

I need to throw 404 when the request url has unknown - extra stuff, like

http://www.example.com/something/1/whatever/can/be/added

Is there some convenient way of achieving this?

preguntado el 25 de septiembre de 13 a las 10:09

Could you post the full route configuration, as normally this already happens whenever a route has more parameters. -

1 Respuestas

No que yo supiese.

The way Zend Router works is if your route is /something/1/another/param/is/here

then obviously in your action then the param "alias" will be 'something' and "page" will be '1'.

But Zend Router will also map these additional params for you, so $this->_getParam("another") will return "param" and $this->_getParam("is") will return "here".

To disable this and throw a 404 you would have to overwrite Zend Router with your own adaption, and throw a 404 if these additional parameters are found.

Respondido el 27 de Septiembre de 13 a las 23:09

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.