I have a login script using a php session under
mydomain.com/login.php . Whenever a user accesses something inside the subfolder
mydomain.com/internal/ I would like to automatically check whether he is logged in (with a custom php script) in order to redirect him to the login page if he's not logged in. Is that somehow possible?
In case it is easier, I would be happy to simply run the custom check-logged-in script before any php script is called under the whole domain.
I am using apache2 on a debian machine.
PS: I am currently adding an include statement for the checked-logged-in script at the head of each file in the
internal subfolder. But this is a bit tedious and has the disadvantage of being rather prone errors (if I forget it when adding a new site).