Are there any potential pitfalls to be aware of when using relative URIs with the "Location:" header in PHP?

When using relative URIs with the "Location:" header in PHP, it's important to be aware that the relative URI will be resolved based on the current request's URI. This can lead to unexpected behavior if the current URI is not what is expected. To avoid this issue, it's recommended to always use absolute URIs when setting the "Location:" header.

// Using absolute URI to avoid pitfalls with relative URIs
header('Location: http://www.example.com/newpage.php');
exit;