So right now I'm redirecting like so: if ($login == "Success") { echo '<script>location.href = "user_account.php";</script>'; }else{ $err = "some error"; } Code (markup): It's sluggish. Takes a couple seconds. I did an html redirect via the header, same thing - sluggish. I'd like redirect from login.php (once a user is logged in) to user_account.php via .htaccess. How do I do that? I know how to do a redirect from one file to another, but how do I do the same only after a successful login? .
Your logic should be at the top of the script before you output anything which means you can use header() ref: https://www.php.net/manual/en/function.header.php if ($login == "Success") { header('Location: https://mysite.com/user_account.php'); exit; } else { $err = "some error"; } PHP: