I have looked through previous questions and answers, but don't see the following clearly explained.

When my users visit /logout, they are successfully logged out and redirected to the website's homepage.

What is not clear to me is how I can detect that action, and display some HTML saying they have been successfully logged out.

1 Answer 1


You can set postLogoutRedirect in your config/general.php (docs) to redirect your users to a specific page, something like 'postLogoutRedirect' => 'your-page'

If you want to use an existing page, say your homepage, and display an alert you could set 'postLogoutRedirect' => '/?loggedout' and check for it in your template using:

{% if craft.app.request.getParam('loggedout') is not null %}
    <p>You have been logged out</p>
{% endif %}
  • Is there a way to pass a unique message through to the target page? I wasn't clear on flash messages either. {% set flashMsg = 'You have just successfully done a thing.' %}
    – 4midori
    Commented Feb 24, 2021 at 19:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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