Top Nav

Apply Basic Auth To Site With Excluded Virtual Path Under Plesk With Apache 2.4

We want to password protect a WordPress development site but allow unauthenticated access to the wp-json/ path. Hosting platform is Plesk with Apache 2.4. We’ll assume the domain is “acme.com” and the assigned IP is “w.x.y.z”.

There are probably better ways to accomplish the goal but this approach seems to work.

Step 1. – In Plesk add a Protected Directory named “/donotremove” and add appropriate user/passwords.

Step 2. – In Plesk on the “Apache & nginx Setting” screen under “Additional nginx directives” add the following:

Step 3. – In Plesk on the “Apache & nginx Setting” screen under “Additional directives for HTTP” and “Additional directives for HTTPS” add the following: