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
5 (1)
Article Rating (1 Votes)
Rate this article
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
jQuery Slider from a Select Element
Viewed 2587 times since Thu, Jan 14, 2010
Google Maps jQuery Plugin - gMap
Viewed 1456 times since Mon, Feb 8, 2010
How to restrict access to your .htaccess file?
Viewed 1061 times since Sun, Mar 14, 2010
SEO (Search Engine Optimization) vs SEM(Search Engine Marketing)
Viewed 924 times since Mon, Jul 12, 2010
jqPlot - jQuery Charts & Plotting Plugin
Viewed 1468 times since Sat, Jan 9, 2010
How do I add and register extra domain names?
Viewed 3694 times since Fri, Oct 9, 2009
Flash Webcam Image Capture
Viewed 1700 times since Thu, Nov 12, 2009
OpenCart - Open Source Shopping Cart
Viewed 1523 times since Fri, Jan 1, 2010
Quick Tables for Showing & Updating DB Data
Viewed 1244 times since Sun, Dec 27, 2009