What could be potential causes for a PHP header('Location:..) redirection issue on a server?

If the `header('Location: ...')` redirection is not working on a server, it could be due to output being sent before the header function is called, or there may be whitespace before the opening PHP tag. To solve this issue, make sure there is no output sent before the header function and ensure there is no whitespace before the opening PHP tag.

<?php
ob_start(); // Start output buffering
// Your PHP code here
header('Location: https://www.example.com');
ob_end_flush(); // Flush output buffer
exit;
?>