It is very doable. Personally, I do not like using redirects and prefer including pages instead, which also makes it easier to retain and control the variables.
However, the trick is to pass the variable along then have your signup page check for it and return the visitor upon a successful login. The methods of passing it could either be cookie, get, or session variable.