HTTP authentication does not work by default with FastCGI, so a workaround is required. First, PHP support must be enabled as a FastCGI application in the domain settings in Plesk. Then, the .htaccess file should be supplemented with specific rewrite rules to set the HTTP_AUTHORIZATION variable. Finally, certain lines must be added to the PHP script that handles the authentication to correctly decode and process the user data.
By default, HTTP authentication does not work under FastCGI, and a workaround must be used, which is described in the following three steps.
1. Make sure that in Plesk, under the domain settings,
“PHP support (run as FastCGI application)” is selected:
2. Add to or create the .htaccess file with the following lines:
RewriteEngine on
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
3. In the PHP script where the HTTP authentication is coded, add the following lines directly before the authentication:
list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':',
base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));