In my project, I am using headless Drupal with .Net on the front end.
I have to use private and encrypted file systems for the project requirements. The files which I am uploading through Drupal private file field from content type are accessible through URL, but as encrypted files aren't accessible through direct URL, I thought of copying the decrypted files from the encrypted folder to the private folder so they become accessible. Strangely, these files aren't accessible for authenticated users, who get access denied for this particular case.
I can't copy these files to the public folder as it is accessible to anonymous users too. So here I am facing two problems:
- Is there any way to restrict public files(sites/default/files/*) to authenticated users only so that anonymous users can't view them? I tried the rewrite rules in the .htaccess file, but it isn't restricting the URL to particular users, and it redirects users to a private URL.
- Is there any way to access the copied files from the private folder via URL?
These files aren't uploaded through Drupal private file field, but they are copied from the encrypted folder to the private folder through custom code.