Protect a folder

Sometime, you may want to restrict the access to web pages or web folders of your website to some users only. This may be a photo album, members-only pages for an association etc.
AlternC allows you to manage this easily, (using .htaccess and .htpasswd file for Apache webserver).

Protected folders

In the File Manager, click the second link "Click here to protect this folder with a login/password". This link allows you to protect the current folder and all its subfolders, and restrict them with login and passwords given to authorized users.

You can restrict the access to those folders to some users. This may be photo albums, members-only pages of an association ...
AlternC allows you to manage this easily, (using .htaccess and .htpasswd file for Apache webserver).

Open the folder "site" in the File Manager and click the link "Click here to protect this folder with a login/password",

Validate the changes by clicking the button [Protect this Folder]

Now open the folder "site" again in the File Manager.
Two new files named ".htaccess" and ".htpasswd" have been generated.

The ".htpasswd" file contains currently no data (0 Bytes). Therefore, no user is allowed to see those files.

To create an authorized user, click the link "Protected Folders" in the main menu of the Virtual Desktop.

Click the "pen" icon.

Click the link "add a user", write a username and a password (don’t use special characters for the username : they may not be accepted)
Validate by clicking the button [add this user].

The user has been authorized.

Then, to add another user that will by authorized in the folder "site", just click the link "add a user".

Now, the ".htpasswd" file in the "site" folder as a non-zero size and contains your login and paswords. Check it by editing it:

The login is present, and the password is encrypted (using MD5). If it get lost, it cannot be recovered, the only solution is to change it (only somebody with access to the Virtual Desktop or to this folder using FTP can change it)

Portfolio

Author Benjamin Sonntag Published : Updated : 24/01/10

Translations : English, français