What are best practices for implementing conditional redirection in PHP based on specific conditions or variables?

When implementing conditional redirection in PHP based on specific conditions or variables, it is important to use control structures like if statements to check the conditions and then use header() function to redirect the user to a different page based on the result of the condition.

<?php
// Check if a specific condition is met
if ($condition) {
    // Redirect to a different page
    header("Location: new_page.php");
    exit;
}
?>