system/CodeIgniter.php
public function storePreviousURL($uri)
	{
		// This is mainly needed during testing...
		if (is_string($uri))
		{
			$uri = new URI($uri);
		}

		if (isset($_SESSION))
		{
			$_SESSION['_ci_previous_url'] = (string) $uri;
		}
	}
public function storePreviousURL($uri)
	{
		// This is mainly needed during testing...
		if (is_string($uri))
		{
			$uri = new URI($uri);
		}

		if (isset($_SESSION))
		{
			$_SESSION['_ci_previous_url'] = (string) $uri;
		}
	}
If we have a session object to use, store the current URI
as the previous URI. This is called just prior to sending the
response to the client, and will make it available next request.

This helps provider safer, more reliable previous_url() detection.

@param \CodeIgniter\HTTP\URI $uri