diff --git a/controller.rst b/controller.rst index ec20a05daa8..54808d2289e 100644 --- a/controller.rst +++ b/controller.rst @@ -132,6 +132,7 @@ If you want to redirect the user to another page, use the ``redirectToRoute()`` and ``redirect()`` methods:: use Symfony\Component\HttpFoundation\RedirectResponse; + use Symfony\Component\HttpFoundation\Response // ... public function index(): RedirectResponse @@ -142,8 +143,8 @@ and ``redirect()`` methods:: // redirectToRoute is a shortcut for: // return new RedirectResponse($this->generateUrl('homepage')); - // does a permanent - 301 redirect - return $this->redirectToRoute('homepage', [], 301); + // does a permanent HTTP 301 redirect + return $this->redirectToRoute('homepage', [], Response::HTTP_MOVED_PERMANENTLY); // redirect to a route with parameters return $this->redirectToRoute('app_lucky_number', ['max' => 10]);