Zend, enrutamiento de URL, URL 404 con parámetros no identificados o desconocidos
Frecuentes
Visto 328 veces
0
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?
1 Respuestas
0
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 zend-framework zend-route or haz tu propia pregunta.
Could you post the full route configuration, as normally this already happens whenever a route has more parameters. - Joseph Callaars