You could try configuring your server to pass or “proxy” all requests to your directory through a php script that can check if the user is logged-in.
Check out the following answer for an example of how to do this:
https://wordpress.stackexchange.com/a/37743/48165