Joomla – how to build logout text link

Joomla Logout Redirect

Joomla Logout Redirect

If you search how to build the logout text link for the Joomla! then you are at the right place now. The answer is below

<a href="index.php?option=com_user&task=logout">Logout</a>

Do you need to redirect user to the needed URL after logout? Then you have to add the parameter return=[your-base64-encoded-return-URL]. For example

<a href="index.php?option=com_user&task=logout&return=<?php echo $returnURL; ?>">Logout</a>


$returnURL = base64_encode('URL to redirect');

Or if you need to redirect to the site root of your Joomla! installation after logout then you can use this link with preencoded return parameter value

<a href="index.php?option=com_user&task=logout&return=Lw">Logout</a>

You can read discussion on this issue at these topics
of the Joomla! discussion forum.