Why is the url being checked again if it was already checked in the conditional statements above?