I am working with some online apps that have a members area, so I obviously need to restrict access to some pages/directories only to members.
So far I have seen two methods to restrict access to specific pages/directories:
- HTTP authentication
- .htaccess
Questions:
1. Are there other methods?
2. What’s the industry standard these days? For instance, what does Facebook or Google use to protect the sections of their websites that only registered users can access?
It really depends on the architecture of the online app. You could also handle authentication in your scripts (PHP for example) and serve everything member specific from external directories.
For example, you could have the following directory tree:
You could store all member specific files in
FilesForMembersand create a script inhttprootthat can serve files fromFilesForMembers.That way the member specific files would be out of reach for the web server.