You will have to create a DATABASE in which you will have informations about every users gender (male/female).
When a user wants to enter one of the two pages by a click onto a button —> take ID of that user —> query the DB where you have all the mentioned info about GENDER, search for that USER (ID) —> find out its GENDER and make an simple if-else-query …
if (foundGender === MALE) {console.log("Go to MALE-PAGE"}
else {console.log("Sorry humanbeeing with boo... not allowed")}
sorry for my humor