code: func (t *Transport) rewriteURL(targetURL string, sourceURL *url.URL) string {
  	url, err := url.Parse(targetURL)
  	if err != nil {
  		return targetURL
  	}
  
  	isDifferentHost := url.Host != "" && url.Host != sourceURL.Host
  	isRelative := !strings.HasPrefix(url.Path, "/")
  	if isDifferentHost || isRelative {
  		return targetURL
  	}
  
  	url.Scheme = t.Scheme
  	url.Host = t.Host
  	origPath := url.Path
  	// Do not rewrite URL if the sourceURL already contains the necessary prefix.
  	if strings.HasPrefix(url.Path, t.PathPrepend) {
  		return url.String()
  	}
  	url.Path = path.Join(t.PathPrepend, url.Path)
  	if strings.HasSuffix(origPath, "/") {
  		// Add back the trailing slash, which was stripped by path.Join().
  		url.Path += "/"
  	}
  
  	return url.String()
  }
docs: // rewriteURL rewrites a single URL to go through the proxy, if the URL refers
  // to the same host as sourceURL, which is the page on which the target URL
  // occurred. If any error occurs (e.g. parsing), it returns targetURL.