Hosting‎ > ‎

Adding HTTP Basic Authentication (htpasswd)

1) Create a new .htpasswd file within the .htpasswds folder. The .htpasswds folder is in the home folder (outside of public_html).

2) Generate content for the .htpasswd file by running the shell command below. Replace 'username' with a custom username for the site and enter a custom  password when prompted.

htpasswd -n username

3) Paste the generated content into the .htpasswd file.

4) Add the lines below to the top of the site's .htaccess file. Replace 'examplepath' & 'examplefolder' with the correct path to the .htpasswd file.

AuthUserFile /home/examplepath/.htpasswds/examplefolder/.htpasswd
AuthName "Please enter your ID and password"
AuthType Basic
require valid-user
order deny,allow

5) Test the password prompt on the site & record / pass on the username & password as required.

Comments