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 73b847d

Browse filesBrowse files
Using const Response::HTTP_MOVED_PERMANENTLY for redirect
1 parent 62c0653 commit 73b847d
Copy full SHA for 73b847d

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.