Question

Hi i need to redirect my users to the same page they were just on after logging into my site, the redirectory code will obviously be a different page depending on the page tehy were last at, any help would be appreciate :)

Was it helpful?

Solution

  1. Put an identifier for the page they are coming from in a hidden input in the form.
  2. Copy it to the form you show on a "Login failed, try again" situation (if there is a failed login, otherwise go directly to 3).
  3. Use that identifier to determine the URL to redirect to with a Location: header after a successful login
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top