Restrict Access to Files

In this article we’ll demonstrate how to use a custom app that redirects files tagged as “private” to a .htaccess protected directory for authentication.

1. Go to ./livewhale/client/modules/

2. Create a new directory (ex., protect_files)

3. Create a new file titled, private.application.protect_files.php

4. Insert the code below. The code can be modified by switching the name of the authenticated directory and the tag being used to query for files that should be restricted.

5. Create a symbolic link in your webroot to point to your /live directory. This directory may vary, but should be the directory serving your files (ie., The symbolic link should also reflect the name of your authenticated-directory in the code. 

6. Place a .htaccess file into your authenticated-directory to restrict access to your files. (See example .htaccess file below)

7. Go to your LiveWhale login screen to activate the change. If you are already logged in, log out and re-login.

8. Now files that are tagged “private” will be redirected to the /authenticated-directory, which will prompt a login from the .htaccess file