Remove trailing slash in split url function