How can relative URIs be converted to absolute URIs for the header Location parameter in PHP redirection?

Relative URIs can be converted to absolute URIs in PHP by using the `$_SERVER['HTTP_HOST']` variable to get the current domain and combining it with the relative URI. This will ensure that the redirection location is a complete absolute URI.

// Get the current domain
$domain = $_SERVER['HTTP_HOST'];

// Relative URI to be redirected to
$relativeURI = "/newpage.php";

// Convert relative URI to absolute URI
$absoluteURI = "http://" . $domain . $relativeURI;

// Redirect to the absolute URI
header("Location: " . $absoluteURI);