Use proper url handling instead of regex to construct the new location