This may be old hat to many, but I always have to go searching for reminders of how to do stuff like this. When I set up a new Joomla site I find it useful to put it behind a password while it is still a “work in progress”. Today while Googling “apache .htaccess” I found alot of very confusing guides and password generators - but at the end of the day it was the elated.com article How-To: Password protecting your pages with htaccess that saved me.
The elated.com instructions worked well for me because I have command line (SSH) access to my server - most people will be looking for a control panel feature for password protection. Usually on the Kabissa server I would use the Plesk control panel for this. The SSH instructions at elated.com took me about 15 seconds:
- navigate to httpdocs dir (or whatever dir will be password protected)
- htpasswd -c .htpasswd admin (then type in password when prompted, and repeat)
- copy htaccess contents from elate.com article to clip board:
AuthUserFile /full/path/to/.htpasswd AuthType Basic AuthName “My Secret Folder” Require valid-user - create .htaccess file and paste in contents (correcting AuthUserFile location)
- Test in browser.
The Plesk control panel is more user friendly but even with a good Internet connection it takes at least several minutes to log in via a web interface, browse to the domain, click on the “directory” icon and type in the username and password to create the password protection.



0 Responses to “Password protection with apache and .htaccess”