Some members of the Maths department have a personal web site.

Sometimes it's desirable to password protect all or part of this site. To do this, you need 2 things - a file called .htaccess (note the . at the start of the name) in the directory you want to protect (it can be the top level public_html or a sub-directory) and a file which contains the username and an encrypted password.

Create the file called .htaccess in the directory you are going to protect and add this content:

AuthType basic
AuthName "My Private Stuff"
AuthBasicProvider file
AuthUserFile /userdir/XXXXXXX/.htpasswd
Require valid-user

The text after AuthName can be anything - this is shown as a prompt to the user. The line AuthUserFile needs to have your username in place of the XXXXXX. The word .htpasswd is the name of a file which will contain the password.

Now choose a username and password. You need to encrypt this and you can use this web site to do it - just enter the username people will need to use and a suitable password. You will get back a line looking like this:

Save the text in a file called .htaccess in the ICNFS home directory (if you're using Linux then that's just the ~ directory; if you're using Windows then it's the \\icnfs-ma.cc.ic.ac.uk\<username> directory)

Now try to visit the web directory you have protected - you should get prompted for a username and password and the one you chose should work.