Redirect user to previous page after registration I'd like users registering on my website are redirected to the page where they clicked the "create account" button which is in a modal.

First, I tried to redirect to an absolute url
I tried 

$form_state-&gt;setRedirect($myUrl);


I tried 

$_REQUEST['destination'] = '&lt;front&gt;';


I tried this too :

$response = new \Drupal\Core\Routing\TrustedRedirectResponse('http://www.google.be');
$form_state-&gt;setResponse($response);


I'm always redirected to /user/[uid]/edit
You could use Rules module to achieve that..