Be sure to have an .htaccess file in the root directory with the following in it:
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
Be sure to have an .htaccess file in the root directory with the following in it:
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
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.