What are best practices for redirecting users to different pages based on their login credentials in PHP?

When users log in to a website, it is common practice to redirect them to different pages based on their login credentials. This can be achieved by checking the user's role or permission level upon login and then redirecting them accordingly using PHP header function.

// Check user's role or permission level upon login
if($user_role == 'admin'){
    header("Location: admin_dashboard.php");
    exit();
} elseif($user_role == 'manager'){
    header("Location: manager_dashboard.php");
    exit();
} else {
    header("Location: user_dashboard.php");
    exit();
}