• Halloween is coming! To celebrate the occasion, we dusted off a couple of old skins, and even created a brand new one (Pixel).
    To get into the festive spirit, install the Skins extension.
  • The new Python extension is now available. It allows customers to deploy and manage WSGI-based Python applications on their websites directly from Plesk.
  • The Plesk Mobile apps for iOS and Android and the Plesk Mobile Center extension have been deprecated, and are no longer available for new installations. In Plesk Obsidian 18.0.84, the Plesk Mobile Center extension will be removed from servers during the upgrade, and the Plesk Mobile apps will lose their server management features.
  • The Social Login extension has been deprecated and will be removed in Plesk Obsidian 18.0.84. After that, it will no longer be possible to log in to Plesk with a Google, Facebook, GitHub account, or with a passkey. Plesk usernames and passwords, as well as logging in with a WebPros Account, are not affected.

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