protected function rewriteUrl($url)
    {
        if (empty($this->hosts)) {
            return $url;
        }

        $proxyHost = rtrim(reset($this->hosts), '/');
        $relativeUrl = parse_url($url, PHP_URL_PATH);

        return $proxyHost . $relativeUrl;
    }
protected function rewriteUrl($url)
    {
        if (empty($this->hosts)) {
            return $url;
        }

        $proxyHost = rtrim(reset($this->hosts), '/');
        $relativeUrl = parse_url($url, PHP_URL_PATH);

        return $proxyHost . $relativeUrl;
    }
protected function rewriteUrl ( $ url ) { if ( empty ( $ this -> hosts ) ) { return $ url ; } $ proxyHost = rtrim ( reset ( $ this -> hosts ) , '/' ) ; $ relativeUrl = parse_url ( $ url , PHP_URL_PATH ) ; return $ proxyHost . $ relativeUrl ; }
Replaces host with given proxy host.

The original method from Liip\ImagineBundle\Imagine\Cache\Resolver\ProxyResolver:rewriteUrl()
doesn't behave correctly when working with domain and port or with host which contains trailing slash.

@param string $url
@return string
Replaces host with given proxy host .