An indirect inguinal hernia occurs through a defect in the abdominal wall, while a direct inguinal hernia protrudes through a weak spot in the muscle wall.