if (isRegistered()) { header('location: dashboard'); exit(); } code example
Example: php location same page
header("Location: " . "http://" . $_SERVER['HTTP_HOST'] . $location);
header("Location: " . "http://" . $_SERVER['HTTP_HOST'] . $location);