Idea 1: Instead of redirecting to the login page, have a popup on each page to login.
Idea 2: When you redirect, send the current page url in a url parameter to the login page. Once login, redirect user to the url page parameter.
In this example we have two pages, the destination and a login page. If you go to the destination page, but are logged out, you are redirected to login. If you login you are redirected to the destination page if it was provided.