redirect('/', Response::HTTP_TEMPORARY_REDIRECT); // Default 302. } // Forward to another controller to avoid redirection, using a path. public function forwardPath(Application $app) { $subRequest = Request::create('/blogs', 'GET'); return $app->handle($subRequest, HttpKernelInterface::SUB_REQUEST); } public function forwardName(Application $app) { /** @var \Symfony\Component\Routing\Generator\UrlGeneratorInterface $generator */ $generator = $app['url_generator']; $subRequest = Request::create($generator->generate('blog_list', 'GET')); return $app->handle($subRequest, HttpKernelInterface::SUB_REQUEST); } }