Añadiendo el código siguiente a nuestro archivo .htaccess
AuthType Basic
AuthName «Página protegida»
AuthUserFile /home/.htpasswd
Require valid-user
<Files admin-ajax.php>
Order allow,deny
Allow from all
Satisfy any
</Files>
<Files admin-post.php>
Order allow,deny
Allow from all
Satisfy any
</Files>
<Files «\.(css|gif|png|js)$»>
Order allow,deny
Allow from all
Satisfy any
</Files>
Para generar el archivo .htpasswd
http://www.htaccesstools.com/htpasswd-generator/
Si quieres aportar otra manera, deja un comentario: