Topic: selective access to Web pages with password

There is now a simple way to enforce a password for a given web page. Here is the recipe:
Goal:
people who want to access your web page secret.html should enter username/password (given to them by you)

Implementation:

  1. define a new directory under ~/public_html/secure:
  2. generate there a file ".htaccess" with a content as in the following example:

    Notice:
    • you can leave out the line with "Allow from".
      Their give you the possibility to allow access only to machines from the given subnetwork.
    • the name ".htpasswd-one" can be changed as you like.
      As default usually ".htpasswords" is used, but if you have different user groups you can use a file for each group.

  3. Generate a pair 'user_name password' with the command "htpasswd":
  4. Build your HTML code in the subdirectory ~/public_html/secure/protected
    Let suppose you did create a "secret.html" file there.

  5. Use the URL:
    https://www.ifh.ee.ethz.ch/~your_user_name/protected/secret.html

    and you will be asked to enter User name and Password for access.