How To Protect a WordPress Site Using Basic Auth in Apache 2.4

Author: , August 25th, 2016

Apache 2.4 changed the security configuration directives a bit. Here is an example using basic auth:

What tripped me up for a while was that I still had the Require all granted directive inside the container, and that needed to be removed for the auth to work.

How To Protect a Single File in Apache

Author: , June 30th, 2013

In order to protect a file, just replace the Directory directive with Files: