code: public function getPath($url)
      {
          $url = new URL($url);
          $to_replace = $this->url->path;
          $path = $url->path;
  
          if (strpos($path, $to_replace) === 0)
              $path = substr($path, strlen($to_replace));
  
          $path = '/' . urldecode($path);
          return $path; 
      }
docs: Extract the path of the provided URL that is below the webroot of this VirtualHost
  
  @param string $url The URL to get the path from
  @return string The path relative to this VirtualHost