Encode URLs to escape pattern special characters