Categories
Server

Basic Authentication with .htaccess and .htpasswd

An .htaccess file in the folder you require the authentication with the following:

AuthUserFile "/home/yoursite/.public_html_wp-admin"
AuthName "Password Protected Area"
AuthType Basic
Require valid-user

An .htpasswd file (referenced in AuthUserFile in the .htaccess file) containing usernames and hashed passwords. Example:

admin:$1$M4XwC9m$e.hXbJvFOZ7n8zN0pf4Yu0

Generate hashed passwords using the MD5 algorithm here.

Design a site like this with WordPress.com
Get started