VDS Sphera Knowledge Base
| Main / Browse Categories / Apache / How do I password protect my site? |
|
You have two choices.
1.) Install the "Web Passwords" ValueApp in your control panel. Web Passwords is a point-and-click utility for password protection of a directory, which allows you to force visitors of your site to enter a username and password, before being able to view that directory of your site. 2.) Add two files to your existing web site: .htpasswd and .htaccess The .htpasswd file is a list of usernames and passwords to give access to your private folders. You can add and delete any number of people to this list (just add/delete entries to/from the .htpasswd file). The .htaccess file is the file that tells the server which directories are password protected. The .htaccess file will not allow anyone on the web to view the page unless they enter a valid username and password.
Creating the .htpasswd file
myname:CFprq2X6tlOGW hisname:g4PoEl8SLw5jbTo create this file, go to the directory that you would like to password-protect and type the command: htpasswd -bc .htpasswd username password'htpasswd' is the program, '.htpasswd' is the file that will be created, '-b' allows the password after the username, 'c' is to create the new file, 'username' is the username of your choice, and 'password' is password of your choice.
Creating the .htaccess file
AuthType Basic AuthUserFile /path/to/the/.htpasswd AuthName "Protected Area" require valid-userIn the AuthName line, you can replace the text with whatever you wish (though you must surround it with quotes). Be sure to replace /path/to/the with the correct path to the directory where the .htpasswd file is located.
User Comments
|
||||||||
| No attachments. |


