In order to do this, you will need Unix shell
access (webhotel Medium or larger). Follow these steps: (Do not include the quote signs around commands when running them)
- Login to your web hotel with SSH, with a program like PuTTY or SecureCRT (Windows), Terminal (MacOS).
- Create an empty file named .htpasswd, do this by executing the command "
You now need to find the path of your web hotel, you can do this by executing the command "
echo $HOME", which returns the path to your home folder. You can also find this via the webhotel's control panel, by viewing the webhotel's primary address or disk usage.
Substitute this for
/home/1/y/youruser/ in the following examples.
Next you run the command
htpasswd -csb /home/1/y/youruser/.htpasswd username password
Note that this command overwrites the file .htpasswd if it already exists!
To add another username and password, enter this command:
htpasswd -sb /home/1/y/youruser/.htpasswd username password
Create a file named .htaccess on your local computer and insert this information, replace
//home/1/y/youruser/.htpasswd with the path to your .htpasswd.
<Limit GET POST>
AuthName "Password protected area"
- Upload .htaccess to your webspace, and place it in the folder that needs password protection. You can copy the same .htaccess to multiple folders.
For security reasons, it is important that the name of the password file is ".htpasswd", and that it is located, if possible, in a different directory than the web hotel. The content of files named .htaccess and .htpasswd are not displayed via WWW unless you override this in .htaccess.
For more info about password protection under Apache, see here: