Warning: stream_socket_client(): php_network_getaddresses: getaddrinfo failed: System error in /home/mathieu/www/rodic-wp/wordpress-20160713/wp-includes/class-wp-http-streams.php on line 150

Warning: stream_socket_client(): unable to connect to ssl://rodic.fr:443 (php_network_getaddresses: getaddrinfo failed: System error) in /home/mathieu/www/rodic-wp/wordpress-20160713/wp-includes/class-wp-http-streams.php on line 150
.htpasswd tutorial – Mathieu Rodic
apache-httpd

.htpasswd tutorial

Apache offers you to protect a folder and its subdirectories with .htaccess files. Learn how to protect your data in only two quick steps!

1. Create an .htpasswd file

Your .htpasswd file will contain the usernames and crypted password of the users who will be allowed in the directory you want to protect; htpasswd files typically look like this:

test:dGRkPurkuWmW2 
foo:YXxOg72kVMUII

…where the part before the semicolon represents the username, and the right part is the encrypted password.

How to generate an htpasswd file ? Just follow these two easy steps:

  1. use this online htpassword generator, type the users you want to add and copy the generated text
  2. paste the text in a file named .htpasswd

2. Configure the .htaccess

Create a file named .htaccess at the root of the folder you want to protect, if it does not already exists. Paste this few lines in the file, then save it:

AuthName "Type a custom text here" 
AuthType Basic 
AuthUserFile /full/path/to/the/.htpasswd 
AuthGroupFile /dev/null 
require valid-user

You will have to edit the location of your .htpasswd file (/full/path/to/the/.htpasswd) for this to work properly.

Leave a Comment


Warning: Unknown: open(/var/lib/php5/sessions/sess_rg1a5r79d8plogvrquh0ap0ha4, O_RDWR) failed: Permission denied (13) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php5/sessions) in Unknown on line 0