Codice PHP:
$dopo $_SERVER['QUERY_STRING'];
$prima $_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'] . ($dopo) ? "?" ""