Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1318,8 +1318,7 @@ the ``template`` option:
Redirecting to URLs and Routes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Use the ``RedirectController`` to redirect to other routes (``redirectAction``)
and URLs (``urlRedirectAction``):
Use the ``RedirectController`` to redirect to other routes and URLs:

.. configuration-block::

Expand All @@ -1328,7 +1327,7 @@ and URLs (``urlRedirectAction``):
# config/routes.yaml
doc_shortcut:
path: /doc
controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction
controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController
defaults:
route: 'doc_page'
# optionally you can define some arguments passed to the route
Expand All @@ -1345,7 +1344,7 @@ and URLs (``urlRedirectAction``):

legacy_doc:
path: /legacy/doc
controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::urlRedirectAction
controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController
defaults:
# this value can be an absolute path or an absolute URL
path: 'https://legacy.example.com/doc'
Expand All @@ -1361,7 +1360,7 @@ and URLs (``urlRedirectAction``):
https://symfony.com/schema/routing/routing-1.0.xsd">

<route id="doc_shortcut" path="/doc"
controller="Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction">
controller="Symfony\Bundle\FrameworkBundle\Controller\RedirectController">
<default key="route">doc_page</default>
<!-- optionally you can define some arguments passed to the route -->
<default key="page">index</default>
Expand All @@ -1377,7 +1376,7 @@ and URLs (``urlRedirectAction``):
</route>

<route id="legacy_doc" path="/legacy/doc"
controller="Symfony\Bundle\FrameworkBundle\Controller\RedirectController::urlRedirectAction">
controller="Symfony\Bundle\FrameworkBundle\Controller\RedirectController">
<!-- this value can be an absolute path or an absolute URL -->
<default key="path">https://legacy.example.com/doc</default>
<!-- redirections are temporary by default (code 302) but you can make them permanent (code 301)-->
Expand All @@ -1394,7 +1393,7 @@ and URLs (``urlRedirectAction``):

return function (RoutingConfigurator $routes) {
$routes->add('doc_shortcut', '/doc')
->controller([RedirectController::class, 'redirectAction'])
->controller(RedirectController::class)
->defaults([
'route' => 'doc_page',
// optionally you can define some arguments passed to the template
Expand All @@ -1412,7 +1411,7 @@ and URLs (``urlRedirectAction``):
;

$routes->add('legacy_doc', '/legacy/doc')
->controller([RedirectController::class, 'urlRedirectAction'])
->controller(RedirectController::class)
->defaults([
// this value can be an absolute path or an absolute URL
'path' => 'https://legacy.example.com/doc',
Expand Down