Check session and env for redirect URL.