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

resides
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.
Comments
There are no comments for this article. Be the first to post a comment.
Name
Email
Security Code Security Code
Related Articles RSS Feed
Open Source WYSIWYG Editor
Viewed 994 times since Thu, Jan 7, 2010
Google Maps jQuery Plugin
Viewed 729 times since Thu, Jan 7, 2010
Create Interactive JavaScript Charts With Highcharts
Viewed 937 times since Fri, Dec 4, 2009
Flash Webcam Image Capture
Viewed 1033 times since Thu, Nov 12, 2009
SEO (Search Engine Optimization) vs SEM(Search Engine Marketing)
Viewed 580 times since Mon, Jul 12, 2010
dygraphs JS Charts - Free JavaScript Charts
Viewed 707 times since Sun, Dec 13, 2009
PHP Quiz Questions and Answers
Viewed 2151 times since Mon, Jan 11, 2010
ProFolio - Instantly Create Free Portfolio Website
Viewed 1056 times since Sun, Jan 3, 2010
Create Navigation Menu Easily with jQuery Menu
Viewed 803 times since Thu, Dec 31, 2009
10 Most Popular JavaScript Frameworks
Viewed 729 times since Thu, Jul 8, 2010
MENU