Use urljoin instead of string manipulation