Skip to content

Commit f59c61f

Browse files
committed
[DX] Improving redirect config
1 parent def3df3 commit f59c61f

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

routing.rst

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,8 +1318,7 @@ the ``template`` option:
13181318
Redirecting to URLs and Routes
13191319
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13201320

1321-
Use the ``RedirectController`` to redirect to other routes (``redirectAction``)
1322-
and URLs (``urlRedirectAction``):
1321+
Use the ``RedirectController`` to redirect to other routes and URLs:
13231322

13241323
.. configuration-block::
13251324

@@ -1328,7 +1327,7 @@ and URLs (``urlRedirectAction``):
13281327
# config/routes.yaml
13291328
doc_shortcut:
13301329
path: /doc
1331-
controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction
1330+
controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController
13321331
defaults:
13331332
route: 'doc_page'
13341333
# optionally you can define some arguments passed to the route
@@ -1345,7 +1344,7 @@ and URLs (``urlRedirectAction``):
13451344
13461345
legacy_doc:
13471346
path: /legacy/doc
1348-
controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::urlRedirectAction
1347+
controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController
13491348
defaults:
13501349
# this value can be an absolute path or an absolute URL
13511350
path: 'https://legacy.example.com/doc'
@@ -1361,7 +1360,7 @@ and URLs (``urlRedirectAction``):
13611360
https://symfony.com/schema/routing/routing-1.0.xsd">
13621361
13631362
<route id="doc_shortcut" path="/doc"
1364-
controller="Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction">
1363+
controller="Symfony\Bundle\FrameworkBundle\Controller\RedirectController">
13651364
<default key="route">doc_page</default>
13661365
<!-- optionally you can define some arguments passed to the route -->
13671366
<default key="page">index</default>
@@ -1377,7 +1376,7 @@ and URLs (``urlRedirectAction``):
13771376
</route>
13781377
13791378
<route id="legacy_doc" path="/legacy/doc"
1380-
controller="Symfony\Bundle\FrameworkBundle\Controller\RedirectController::urlRedirectAction">
1379+
controller="Symfony\Bundle\FrameworkBundle\Controller\RedirectController">
13811380
<!-- this value can be an absolute path or an absolute URL -->
13821381
<default key="path">https://legacy.example.com/doc</default>
13831382
<!-- redirections are temporary by default (code 302) but you can make them permanent (code 301)-->
@@ -1394,7 +1393,7 @@ and URLs (``urlRedirectAction``):
13941393
13951394
return function (RoutingConfigurator $routes) {
13961395
$routes->add('doc_shortcut', '/doc')
1397-
->controller([RedirectController::class, 'redirectAction'])
1396+
->controller(RedirectController::class)
13981397
->defaults([
13991398
'route' => 'doc_page',
14001399
// optionally you can define some arguments passed to the template
@@ -1412,7 +1411,7 @@ and URLs (``urlRedirectAction``):
14121411
;
14131412
14141413
$routes->add('legacy_doc', '/legacy/doc')
1415-
->controller([RedirectController::class, 'urlRedirectAction'])
1414+
->controller(RedirectController::class)
14161415
->defaults([
14171416
// this value can be an absolute path or an absolute URL
14181417
'path' => 'https://legacy.example.com/doc',

0 commit comments

Comments
 (0)