Linux: .htaccess and .htpasswd files

Warning: Use of undefined constant user_level - assumed 'user_level' (this will throw an Error in a future version of PHP) in /homepages/3/d98111892/htdocs/insanelabs/htdocs/wp-content/plugins/ultimate-google-analytics/ultimate_ga.php on line 524

You can use .htaccess to protect a directory on your Apache web server. Users trying to access a protected directory will be asked to enter a user and password. .htaccess defines the protected directory, and .htpassword stores your password hashes.

.htaccess normally looks like this:

AuthName "Title"
AuthUserFile /path-to-your-htpasswd-file/.htpasswd
AuthType Basic
require valid-user

To create a .htpasswd file:
htpasswd -c / <username>


htpasswd -c <username>

and you will be prompted to enter a password for <username>

Of course, you can use a .htpasswd generator. Remember, Google is your friend 🙂