That's pretty neat, but doesn't it make more sense to use before_filter in your controller for that stuff so that you can properly handle errors instead of showing a 404?
I guess that is what the op trying to do.
So they can use the back arrow and go to the page they at before login redirected them?
I found Drupal's hiding of the login page once I was logged to be truly annoying on a site I regularly visited (till it was apparently changed recently).