- Create a .htpasswd file:
$ htpasswd -c .htpasswd <username> password:
- Create or add these lines to .htaccess file:
- To protect a directory:
AuthUserFile /full/path/to/.htpasswd AuthType Basic AuthName "Protected Folder" Require valid-user
- To protect a file:
AuthUserFile /full/path/to/.htpasswd AuthType Basic AuthName "Protected Page" <Files "protected_page.html"> Require valid-user </Files>
- To protect a directory:
Tuesday, November 15, 2011
How to protect a web page with htaccess with a password
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment