What could be causing the issue with the Header Location function not working when including another PHP script?

The issue with the Header Location function not working when including another PHP script could be due to output being sent before the Header function is called. To solve this issue, make sure that there is no whitespace or any output before calling the Header function.

<?php
ob_start(); // Start output buffering

// Include the other PHP script here
include 'other_script.php';

// Make sure there is no output before calling the Header function
header('Location: new_page.php');

ob_end_flush(); // Flush the output buffer
exit; // Stop further execution
?>