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 1


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:

  1. 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.
  2. 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).
  3. 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:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.