Daha önceden böyle bir durumla karşılaşmıştım, bazen o soru işaretlerini kütüphaneler falan otomatik ekliyor, öntanımlı ifadelerde de olabilir.

Tek yapman gereken URL'de regex ile ikinci bir ? işareti aramak ve ikiye ayırıp ikinci kısımdaki soru işaretlerini temizlemek.


echo $requesturl = "https://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
echo '
';

preg_match_all('/[?]/',$requesturl, $matches, PREG_OFFSET_CAPTURE);

// if there is second question mark
if (isset($matches[0][1][1])) {
// start pos from first match index
$startpos = $matches[0][0][1] + 1;
// total string lenght - start pos
$endpos = strlen($requesturl) - $startpos;
// replaced new url
$newrequesturl = substr($requesturl, 0, $startpos).str_replace('?', null, substr($requesturl, $startpos, $endpos));

print_r($newrequesturl);
// go
header("Location: {$newrequesturl}");
}
?>