When login from certain points, there is a ?next GET variable that is used to track where to redirect the user after the login. However, the login always redirect to the homepage.
?next