APACHE LDAP authentication to download files

Is there any way to configure Apache web server to ask for LDAP credentials before download a file with a filename that starts with a fixed string?. I mean, suppose you have a folder with documents inside and you can download them freely from URL like myserver/docs/doc1.pdf.
The case is that inside “docs” folder I need to include some restricted documents that must be only downloaded from authenticated users. I though about renaming private documents and make filename starts with “priv-” string like “priv-doc3.pdf” so I need to configure Apache to ask for credentials only it the filename to download starts with “priv-”. Is it possible?.
Configuring block or adding .htaccess file?.

Thanks in advance.


Yes you need to use Apache Module mod_authnz_ldap which allows an LDAP directory to be used to store the database for HTTP Basic authentication. More info below: