Tag Archive for 'protect'

Easy Password Protect

Every wanted to password protect files or directories without having to code a custom login script? It’s easier than you think. Follow the steps below.

1. Create a .htaccess file with the following:

AuthUserFile /full/path/to/.htpasswd
AuthType Basic
AuthName "My Secret Page"

<Files "mypage.html">
Require valid-user
</Files></code>

<code><Files "myotherpage.html">
Require valid-user
</Files>

2. Create a .htpasswd file with a list of usernames and passwords:
fred:p29cmnwl4a0et
linda:vwp45xakfh89

One thing to note, passwords in the .htpasswd file are encrypted. Don’t worry google, ‘htpasswd generator’ and you’ll find plenty of tools for encrypting.