Intro to: .htaccess and .htpasswd
So you’ve got a bunch of people who you would like to provide with content on your website. You also do not want everyone that visits your site to view this information. How do you allow access to some members, but not to others? The simple solution is to create a members area in your site by creating .htaccess and .htpasswd files!
The .htaccess file is a simple text file that allows you to change some of the configuration directives of the web server. The .htaccess file is much more powerful than just that and I hope to explain more about it in this article. It is worth noting that .htaccess files are not compatible with Windows Servers.
The .htaccess file has many uses including: Blocking Users by IP Address, Preventing or Allowing Directory Listings, and Changing Error Documents. In this post I will focus on using the .htaccess file to password protect your folders. This can be useful if you wish to set up something like a “Members” area on your web page that will allow only users that have a username and password access to these areas. You can create a .htaccess and a .htpasswd file in order to set up simple user/pass protection.
Password protection relies on two files. The .htaccess file tells the webserver that viewing content in such folders requires authorization. The second is the .htpasswd file and it contains the information about the users and their passwords. The information in your .htpasswd file will be very simple and will look like this:
webuser:qkbPmuht5Gzgc
Oct