Skip to content

[FrameworkBundle] feature: redirect query params too in RedirectController #9314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 26, 2018
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
9 changes: 9 additions & 0 deletions routing/redirect_in_config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ action:
controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction
defaults:
route: sonata_admin_dashboard
# make a permanent redirection...
permanent: true
# ...and keep the original query string parameters
keepQueryParams: true

.. code-block:: xml

Expand All @@ -129,7 +132,10 @@ action:
<route id="admin" path="/wp-admin">
<default key="_controller">Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction</default>
<default key="route">sonata_admin_dashboard</default>
<!-- make a permanent redirection... -->
<default key="permanent">true</default>
<!-- ...and keep the original query string parameters -->
<default key="keepQueryParams">true</default>
</route>
</routes>

Expand All @@ -145,7 +151,10 @@ action:
$collection->add('admin', new Route('/wp-admin', array(
'_controller' => 'Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction',
'route' => 'sonata_admin_dashboard',
// make a permanent redirection...
'permanent' => true,
// ...and keep the original query string parameters
'keepQueryParams' => true,
)));

return $collection;
Expand Down