Home :: Blog :: Articles :: Web-Hosting :: How to Password protect your directories / files using htaccess file

How to Password protect your directories / files using htaccess file

How to Password protect your directories / files using htaccess file
Category: Web-Hosting
Posted:
Views: 1311
Comments: 0 [Post]
Synopsis: Authentication for certain files and directories from being accessed. The code has examples of both password protection for a single file and password protection for a entire directory.

Authentication for certain files and directories from being accessed. The code has examples of both password protection for a single file and password protection for a entire directory.

# 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



Comments on How to Password protect your directories / files using htaccess file

Start the conversation by being the first to comment!

Share comments

Your Name: *
Comments: *
Please Note: HTML Markup will be automatically removed.
The ability to post urls has been disabled by the site administrator.
*
Type the characters you see in the picture:

*