I'm new to Drupal and here is the requirement - There is a page that has a field (Doc link) of type Link. I give the URL of the Doc link field as /sites/default/files/docs/file1.html. Now when I click on this Doc link field it shows the entire folder structure of file1.html in the web browser. I don't want users to see the actual path where file1.html is stored. I want to be able to mask/hide this URL in the web browser. So instead of displaying https://xyz.com/sites/default/files/docs/file1.html I want to display a generic link - https://xyz.com/docs/latest/file1.html. Is there any module that I could use to achieve this?
1 Answer
It sounds like you want to store the file in Drupal's private file system. There is no need for a module - this is in core.
Files that are in the private system will:
- Be protected from access by Drupal's core access control system. If the user don't have access to the page where the file field is attached, he/she will not have access to the file.
- The URL will not be generally usable. (i.e. the link will be displayed in the browser's address field, but only works "inside" Drupal).
- If you place your private files outside the webroot (strongly recommended), they can only be accessed through Drupal's access control system. There is no real URL that can be guessed.
There is plenty of tutorials about setting up and using a private file system in Drupal [GIYF]. Here is a link to one example: