I want to upload some websites I have worked on to an Apache server. What I would like to do though is to use an .htaccess file or something similar to redirect the user to a login page if they go beyond a certain folder depth. When logged in I want them to be able to view the directory and go past the main folder directory.
To elaborate further; A user should be able to view
www.exmample.com/about.html but if they go into further folders such as
www.example.com/folder/index.html I want to redirect them to a login page. If the user if verified I want them to be able to see
www.example.com/folder/index.html along with other things.
Any suggestions on how to do this?
I was thinking maybe using .htaccess to redirect to the php page and then edit the .htaccess via PHP if verified but I'm not even sure how to limit folder permissions via the .htaccess file.