# Logout

To log a user out, use the logoutUrl (opens new window) global variable provided by Craft:

{% if currentUser %}
    <a href="{{ logoutUrl }}">Logout</a>
{% endif %}

# Custom Redirect

By default, Craft will redirect the user to the homepage after logging out. To customize this behavior, use Craft’s postLogoutRedirect (opens new window) general config setting:

'postLogoutRedirect' => 'members'