• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Question How to except one URL from protected directories?

TinaBura

Basic Pleskian
Hi,
I have a subdomain that should be entirely protected. I have setup protected directories in Plesk and it works. Now I need to except one URL from basic_auth. Additionally the URL has parameters. Example:
This is needed for an API that uses the URL to get contents from the project. I cannot change the API, I can only "free up" the URL. Is it possible? The server uses nginx with Apache.
Thanks,
Tina
 
Last edited:
This cannot be achieved by the built-in password-protected-directories function of Plesk. Instead, you need to create an .htpasswd file and an .htaccess file (or modify the existing .htaccess file in the document root directory of your subdomain) where you specifcy with environment variables what shall be protected and what not. It could look somewhat similar to this:

Code:
AuthName "Protected directory"
Require valid-user
AuthUserFile "/some-directory-for-the-password-file/.htpasswd"
AuthType basic
SetEnvIf Request_URI "(path/to/directory/)$" allow
SetEnvIf Request_URI "(path/to/file\.php)$"  allow
Order allow,deny
Allow from env=allow
Satisfy any

The SetEnvIf settings combined with "allow" exclude the given directories or files from the protection. You will also need to create the .htpasswd file with a user name and the encrypted password. For more details, please try a search engine search for keywords like ".htaccess password protected directories" or similar.
 
Back
Top