public function makeUrl($path, $domain = false) {
        if (!$path) {
            $path = $this->getPath();
        }

        // Check for a specific scheme.
        $scheme = $this->getScheme();
        if ($domain === 'http' || $domain === 'https') {
            $scheme = $domain;
            $domain = true;
        }

        if ($domain === true) {
            $prefix = $scheme.'://'.$this->getHostAndPort().$this->getRoot();
        } elseif ($domain === false) {
            $prefix = $this->getRoot();
        } elseif ($domain === '//') {
            $prefix = '//'.$this->getHostAndPort().$this->getRoot();
        } else {
            $prefix = '';
        }

        return $prefix.'/'.ltrim($path, '/');
    }