How do I password protect one of my web site directories?

We can password protect a directory for you quickly and easily. Just email us at support@brownrice.com OR you can do it yourself if you are a web site developer by following these instructions:

  1. On your computer create an special file exactly called ".htaccess" (without the quotes).
  2. This file's contents should look like this (below). Change the values in red to your web site address and the exact directory name that you are protecting. This file is case sensitive:

 

AuthName "Restricted Access"
AuthType Basic
AuthUserFile /home/domains/yourwebsite.com/docs/protecteddirectory/.htpasswd

require valid-user

 

Now create a second file on your computer called ".htpasswd" (again without the quotes). Go to this site and generate a username and password. You'll end up with something like this:

 

myusername:YXWM35gonN/VU

 

  • Paste your version of the above encrypted username and password into your new .htpasswd file.
  • FTP both of your new files into the password protected directory on your web site. Make sure your FTP program sends this file to the server as an ASCII or "plain text" file. It will not work if this is sent as a binary type file.
  • Using a Browser surf to your new password protected web directory and ensure that it works correctly.

You cannot comment on this entry