$url = $_GET['url']; // берем get параметр
header("Location: $url");
function redirect(string $current, string $to): void
{
$url = sprintf('%s?url=%s', $to, urlencode($current));
header("Location: ${url}");
exit();
}
header("Location: {$_GET['url']}");
$url = $_GET['url']; // берем get параметр
header("Location: $url");