return $parts['scheme'] . "://" . $parts['host'] . $parts['path'];
}
+ function cleanup_url_path($path) {
+ $path = str_replace("/./", "/", $path);
+ $path = str_replace("//", "/", $path);
+
+ return $path;
+ }
+
/**
* Converts a (possibly) relative URL to a absolute one.
*
} else if (strpos($rel_url, "/") === 0) {
$parts = parse_url($url);
$parts['path'] = $rel_url;
+ $parts['path'] = cleanup_url_path($parts['path']);
return build_url($parts);
$dir !== '/' && $dir .= '/';
}
$parts['path'] = $dir . $rel_url;
+ $parts['path'] = cleanup_url_path($parts['path']);
return build_url($parts);
}