public function swapDirectoryFilter($path_or_url, $directory)
    {

        $path = $this->decomposeUrl($path_or_url);
        $path_parts = pathinfo($path['path']);
        $new_path = $directory . DIRECTORY_SEPARATOR . $path_parts['basename'];

        $output = $path['prefix'] . $new_path . $path['suffix'];
        return $output;
    }