How to force a redirect (override the destination query string in the URL) I have a custom form submit callback to redirect users to a specific page:

function MYMODULE_authfrontpageredirect_callback(array &amp;$form, FormStateInterface &amp;$form_state) {
  $url = \Drupal::service('path.validator')-&gt;getUrlIfValid('node/16');
  $form_state-&gt;setRedirect($url-&gt;getRouteName(), $url-&gt;getRouteParameters());
}


This works correctly unless the url has a destination query string, such as
/node/add/mynode?destination=/user

In this case, the user will be redirected based on the query string (to /user) instead of my submit handler destination (node/16).

How do I forcibly override the destination query string content for this submit handler?

This question is similar to this D7 question but since Drupal 8 has the Symfony routing system the answers there did not help me.
To force a redirect remove the destination query string from the request:

\Drupal::request()-&gt;query-&gt;remove('destination');


After this you can also reset the RedirectDestination service, although this seems not to be necessary for a form:

\Drupal::destination()-&gt;set(NULL);


When you have already a URL object set it directly in $form_state:

$form_state-&gt;setRedirectUrl($url);