Skip to content

Commit 7210586

Browse files
SimperfitAmrouche Hamza
authored and
Amrouche Hamza
committed
feature: redirect query params too in RedirectController
Adding documentation for the redirectAction improvement
1 parent d2ccdcf commit 7210586

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

routing/redirect_in_config.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ Redirecting Using a Route
9696

9797
Assume you are migrating your website from WordPress to Symfony, you want to
9898
redirect ``/wp-admin`` to the route ``sonata_admin_dashboard``. You don't know
99-
the path, only the route name. This can be achieved using the
99+
the path, only the route name, if you pass query parameters to this route and active the ``keepQueryParams``, it will be redirected too. This can be achieved using the
100100
:method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\RedirectController::redirectAction`
101101
action:
102102

@@ -114,6 +114,7 @@ action:
114114
defaults:
115115
route: sonata_admin_dashboard
116116
permanent: true
117+
keepQueryParams: true
117118
118119
.. code-block:: xml
119120
@@ -130,6 +131,7 @@ action:
130131
<default key="_controller">Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction</default>
131132
<default key="route">sonata_admin_dashboard</default>
132133
<default key="permanent">true</default>
134+
<default key="keepQueryParams">true</default>
133135
</route>
134136
</routes>
135137
@@ -146,6 +148,7 @@ action:
146148
'_controller' => 'Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction',
147149
'route' => 'sonata_admin_dashboard',
148150
'permanent' => true,
151+
'keepQueryParams' => true,
149152
)));
150153
151154
return $collection;

0 commit comments

Comments
 (0)