Is it possible to specify a target when redirecting to a different URL in PHP?

When redirecting to a different URL in PHP, it is possible to specify a target by including it in the URL itself. This can be achieved by appending the target as a query parameter to the URL. For example, if you want to redirect to "example.com" with a specific target page "page2.php", you can construct the URL as "example.com?page=page2.php".

<?php
// Specify the target page
$targetPage = "page2.php";

// Redirect to the specified target page
header("Location: example.com?page=$targetPage");
exit;
?>