To redirect users after a successful login with the 'login module' you must choose a menu item under the 'Options' tab, 'Basic Options' Section.
From the screenshots you can see the choices of redirection pages are paired to the established menu items under each menu. For example, the top menu has the menu items, Home, Sample Sites and Joomla.org as choices. The menus items are grouped by the menu type(alias), Top is called top, User Menu is usermenu and so on.
To redirect a user after a successful log in, select the redirection page from the list of menu links offered. Make sure that the menu item selected is a published menu item.
Note: The same procedure is used for redirecting users on successful logout except you enter the page where you want to redirect successful logouts to where it says "Logout Redirection URL." Choose the Logout Redirection page the same way you would choose the Login Redirection page using the drop down choice of menu item.
If you would like to override the default login specified in your Administration back end from your custom code you can do so with the following:
$redirectUrl = urlencode(base64_encode($redirectUrl)); // a base64_encode of index.php?option=com_pizzapie' yeilds: 'aW5kZXgucGhwP29wdGlvbj1jb21fcGl6emFwaWU='
|If you use a string returned by base64_encode in a URL as a parameter, be sure to escape it with urlencode.
$redirectUrl = '&return='.$redirectUrl;
$joomlaLoginUrl = 'index.php?option=com_user&view=login'; $finalUrl = $joomlaLoginUrl . $redirectUrl;
When you display that $finalUrl, it should look something like this: 'index.php?option=com_user&view=login&return=aW5kZXgucGhwP29wdGlvbj1jb21fcGl6emFwaWU='
The controller.php file in the com_user checks the contents of the 'return' in the JRequest object (the Joomla query access object). If it is set and in the base64 format, it base64_decode(s) it and applies that redirection.