Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c1d1df6

Browse filesBrowse files
committed
minor #16206 Using const Response::HTTP_MOVED_PERMANENTLY for redirect (ThomasLandauer)
This PR was merged into the 4.4 branch. Discussion ---------- Using const `Response::HTTP_MOVED_PERMANENTLY` for redirect Commits ------- 73b847d Using const `Response::HTTP_MOVED_PERMANENTLY` for redirect
2 parents 62c0653 + 73b847d commit c1d1df6
Copy full SHA for c1d1df6

File tree

Expand file treeCollapse file tree

1 file changed

+3
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-2
lines changed

‎controller.rst

Copy file name to clipboardExpand all lines: controller.rst
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ If you want to redirect the user to another page, use the ``redirectToRoute()``
132132
and ``redirect()`` methods::
133133

134134
use Symfony\Component\HttpFoundation\RedirectResponse;
135+
use Symfony\Component\HttpFoundation\Response
135136

136137
// ...
137138
public function index(): RedirectResponse
@@ -142,8 +143,8 @@ and ``redirect()`` methods::
142143
// redirectToRoute is a shortcut for:
143144
// return new RedirectResponse($this->generateUrl('homepage'));
144145

145-
// does a permanent - 301 redirect
146-
return $this->redirectToRoute('homepage', [], 301);
146+
// does a permanent HTTP 301 redirect
147+
return $this->redirectToRoute('homepage', [], Response::HTTP_MOVED_PERMANENTLY);
147148

148149
// redirect to a route with parameters
149150
return $this->redirectToRoute('app_lucky_number', ['max' => 10]);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.