1

Public files in Drupal have a relative path that is similar to /sites/default/files/file.txt; private files have a relative path similar to /sites/default/files/privates and system files have a relative path similar to /system/files/file.txt.

How can I make the relative path for public files be /public/files/file.txt?

2 Answers 2

1

You can change the path using below step.

  • Go to Administration -> Configuration -> Media
  • Click on 'File system' link
  • Change the directory in text-field 'Public file system path' and save the configuration.
0
1

I think that what you are looking for is similar to How to hide /sites/default/files from URLs? In that case, try the File Aliases module.

The File Aliases module allows you to use token customizable aliases for your uploaded files, giving you the ability to keep your file system organized as per usual while providing clean looking paths (i.e., no more '/sites/default/files/').

Features:

  • Customizable File Alias field using Node tokens. Support for:
    • Drupal core Upload module.
    • FileField module.
    • ImageField module.
    • Image module.
    • Comment Upload module.
  • Support for Private and Public file systems.
  • Support for Views output (Fields and Nodes).
  • Support for FileField Paths Retroactive and Active Updating.
0

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.