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
Stylish Cross-Browser CSS Buttons - Simply-Buttons v2
Viewed 1218 times since Thu, Nov 12, 2009
Create Dynamic Tabs with jQuery
Viewed 1180 times since Sat, Feb 6, 2010
Best Free Web Icons for Different Purposes
Viewed 1406 times since Mon, Dec 28, 2009
How do I setup and use SSH?
Viewed 1851 times since Thu, Oct 15, 2009
ICEpdf - Open Source Java PDF Library
Viewed 1503 times since Wed, Jan 6, 2010
Web Usability Testing Tool - Clixpy
Viewed 1678 times since Sat, Jan 9, 2010
Speech Bubbles With Pure CSS3
Viewed 1182 times since Fri, Mar 12, 2010
Use PHP Functions In JavaScript with PHP.JS Library
Viewed 1070 times since Fri, Jan 8, 2010
What is jQuery?
Viewed 1053 times since Tue, Dec 1, 2009