Codice PHP:
$str 'http://example.it/index.php?option=valore&view=idpagina&altravar=altrovalore';

$query_string parse_url($strPHP_URL_QUERY);
parse_str($query_string$segments);

$url 'http://example.com/'.implode('/'$segments);
echo 
$url