public function getRedirect($url = null)
    {
        // If a url to redirect to was specified
        if ($url) {
            
            // If the redirect is being specified as an offset such as "-2"
            if (is_numeric($url)) {
                
                // Just clarifying that the URL (in this case) is steps to take backwards in the history array, not an actual URL.
                $steps = $url;
                
                // If you want to send the user back 2 steps, you would pass in -2 as the steps.
                // Adding this negative number to the number of items in the history array gives the desired URL offset.
                $offset = count($_SESSION['redirect']['history']) + $steps;
                
                // Check if such an offset exists.
                if (isset($_SESSION['redirect']['history'][$offset])) {
                    
                    $redirect = $_SESSION['redirect']['history'][$offset];
                    if (!empty($redirect)) {
                        return $redirect;
                    } else {
                        return BASE_URL;
                    }
                }
                
                // Otherwise redirect to homepage as fallback.
                else {
                     return $this->config['site_url'];
                }
            } 
            
            // If the URL is an actual URL.
            else {
                // If the URL is specified as a relative URL, then include the 'site_url' setting at beginning.
                if (substr($url, 0, 1) == '/') {
                    return $this->config['site_url'].substr($url, 1);
                }
                else {
                    return $url;
                }
            }
        } 
        
        // Redirect to home page.
        else {
            return $this->config['site_url'];
        }
    }