Ho memorizzato in sessione l'url così

$_SESSION['url'] = "http://" . $_SERVER["HTTP_HOST"] . $_SERVER ["REQUEST_URI"];