symfony redirect with 2 parameters

You can also use redirect, specifying the route name and the parameter array:

$this->redirect('route_name', array('year' => $year, 'month' => $month));

(Tested on Symfony 1.4)


In the currently supported Symfony versions (2.7+) it's even easier (plus, you can optionally add also the status code at the end):

return $this->redirectToRoute(
    'default',
    array('year' => $year, 'month' => $month),
    Response::HTTP_MOVED_PERMANENTLY // = 301
);

Well, that's normal, "redirect" redirect to an absolute URL. You can do that:

$this->redirect($this->generateUrl('default', array('module' => 'input',
'action' => 'new', 'year' => $year, 'month' => $month)));