8 – 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


I tried

$_REQUEST('destination') = '<front>';

I tried this too :

$response = new DrupalCoreRoutingTrustedRedirectResponse('http://www.google.be');

I’m always redirected to /user/(uid)/edit