Hey folks, so this comes up really often with Rackspace customers, how to add AuthType Basic HTTP authentication. This is akin to an additional user/pass dialog box which appears when navigating to the url. It is really easy to create a new password:
htpasswd -c /etc/httpd/.htpasswd-private username
Please note .htpasswd-private can be anything, however it’s better to make it a hidden file by prefixing with a . dot, also important to ensure that the password file isn’t in a web documentroot, the file should have user and group root root, but that should be done automatically when you create the file with root user.
This is what I added to phpmyadmin configuration file in /etc/httpd/conf.d/phpMyAdmin.conf
<Location "/phpMyAdmin/"> AuthType Basic AuthName "Private Server" AuthUserFile /etc/httpd/.htpasswd-private Require valid-user </Location>
You could do the same for WordPress;
<Location "/wp-admin/"> AuthType Basic AuthName "Private Server" AuthUserFile /etc/httpd/.htpasswd-private Require valid-user </Location>
Please note that I am using Location, but you can apply the same thing within a directive instead.