What are the potential pitfalls of using relative URLs in the header() function for redirection in PHP?

Using relative URLs in the header() function for redirection in PHP can lead to unexpected behavior if the base URL changes or if the script is included in another file with a different directory structure. To avoid this issue, it's recommended to use absolute URLs instead.

// Redirect to an absolute URL
header("Location: http://example.com/newpage.php");
exit();