[API] Improve matching url to avoid superfluous slashes.