I'm trying to send a redirect after logout, but it is not sending properly. I tried using the hook_user_logout in a module as follows:

use Drupal\Core\Routing\TrustedRedirectResponse;

function module_user_logout($account) {
  $redirect = new TrustedRedirectResponse($url);

The send() call causes the page to crash with the message: "The __ page isn't working"


maybe because the $url is empty ?

Or maybe because you need to add return at the end of the function.


  • If you want to ask more information about the question, you are better to leave comment under the question but not answering the question :) – Jimmy Ko Jul 21 '16 at 23:37
  • Thank you, but i didn't have enough point to comment yet. :/ – Denis Kolmerschlag Jul 22 '16 at 6:04
  • Umm... I see your pain :( – Jimmy Ko Jul 22 '16 at 7:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.