<p>You can set <code>postLogoutRedirect</code> in your <code>config/general.php</code> (<a href="https://craftcms.com/docs/3.x/config/config-settings.html#postlogoutredirect" rel="nofollow noreferrer">docs</a>) to redirect your users to a specific page, something like <code>'postLogoutRedirect' =&gt; 'your-page'</code></p>
<p>If you want to use an existing page, say your homepage, and display an alert you could set <code>'postLogoutRedirect' =&gt; '/?loggedout'</code> and check for it in your template using:</p>
<pre class="lang-twig prettyprint-override"><code>{% if craft.app.request.getParam('loggedout') is not null %}
    &lt;p&gt;You have been logged out&lt;/p&gt;
{% endif %}
</code></pre>

CC BY-SA 4.0
2021-02-24T19:46:20.307Z
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
CC BY-SA 4.0
2021-02-17T07:17:49.377Z
2021-02-17T07:17:49.377Z
Oli
<p>I have looked through previous questions and answers, but don't see the following clearly explained.</p>
<p>When my users visit <em>/logout</em>, they are successfully logged out and redirected to the website's homepage.</p>
<p>What is not clear to me is how I can detect that action, and display some HTML saying they have been successfully logged out.</p>

<form><action><flash>
Display message on logout (flash?)
# Display message on logout (flash?)

(Asked by: username_0 on 2021-02-16)

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.

**Tags:** form, action, flash


---

## 1 answers

### Answer by username_1 on 2021-02-17. Score: 3 | Accepted answer

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 %}
    You have been logged out
{% endif %}

> **Comments:**
> **username_0**: 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.' %}  

---

