The inguinal canal allows structures like blood vessels, nerves and the vas deferens to pass from the abdomen into the scrotum. It functions like a box with anterior and posterior walls, a roof and floor. The spermatic cord passes through the deep inguinal ring into the canal and exits through the superficial inguinal ring. The walls are weakest around the rings, so hernias typically occur here. Indirect inguinal hernias pass through the deep ring and travel along the canal, while direct hernias bulge directly through the superficial ring.