Article Diary - General Knowledge Digest

How to password protect folder/files using htaccess file?

Use the following htaccess code to enable authentication for certain files and folders from being accessed. The code has examples of password protection for a single file and password protection for a entire directory using htaccess file.

# to protect a file

AuthType Basic
AuthName “Prompt”
AuthUserFile /home/path/.htpasswd
Require valid-user

# password-protect a directory

AuthType basic
AuthName “This directory is protected”
AuthUserFile /home/path/.htpasswd
AuthGroupFile /dev/null
Require valid-user
Attached Files
There are no attachments for this article.
There are no comments for this article. Be the first to post a comment.
Security Code Security Code
Related Articles RSS Feed
Create Glowing, Radioactive Buttons with CSS
Viewed 815 times since Sun, Dec 27, 2009
Open Source Online Invoice System - siwapp
Viewed 1110 times since Thu, Jan 7, 2010
Search Engine Optimization: Tags of Importance for SEO
Viewed 828 times since Tue, Oct 12, 2010
SEO Poisoning - What are SEO Poisoning Attacks?
Viewed 1090 times since Mon, Apr 5, 2010
Google Maps jQuery Plugin - gMap
Viewed 1081 times since Mon, Feb 8, 2010
Admin Skins - Constellation Complete Admin Skin
Viewed 1081 times since Thu, Aug 12, 2010
Create Dynamic Tabs with jQuery
Viewed 809 times since Sat, Feb 6, 2010
ProFolio - Instantly Create Free Portfolio Website
Viewed 1191 times since Sun, Jan 3, 2010