Function to validate urls.