Check if the URL is valid before adding.