Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitc1d1df6

Browse files
committed
minor#16206 Using constResponse::HTTP_MOVED_PERMANENTLY for redirect (ThomasLandauer)
This PR was merged into the 4.4 branch.Discussion----------Using const `Response::HTTP_MOVED_PERMANENTLY` for redirectCommits-------73b847d Using const `Response::HTTP_MOVED_PERMANENTLY` for redirect
2 parents62c0653 +73b847d commitc1d1df6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

‎controller.rst‎

Lines 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 permanentHTTP 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)

[8]ページ先頭

©2009-2025 Movatter.jp