How to redirect to a page after submitting a form I have a custom module that displays a form.

Upon submitting the form, I want to redirect the user to a different page.

How can I do that?
In the submit handler you do

Drupal 7:

$form_state['redirect'] = 'url';


Drupal 8:

$form_state-&gt;setRedirect('route', $args, $options);
$form_state-&gt;setRedirectUrl(\Drupal\Core\Url);