4

I want to upload files to their normal directory under /sites/default/files/. So let's assume I have example.pdf uploaded to sites/sites/default/files/manuals/example.pdf.

I want the links to files look like http://example.com/manuals/example.pdf. I think it's simpler and looks more professional.

How can I achieve it with Drupal?

  • I was sure it was asked, but I can't find it. If it will not be marked as a duplicate, I'll post an answer in a day or two. Unless someone will want to answer, of course. – Mołot Sep 3 '13 at 13:11
  • easy for image drupal.org/project/image_field_url_replacer – Bala Sep 3 '13 at 13:22
  • There was a module that did that once upon a time. Doesn't seem to exist any more though – Clive Sep 3 '13 at 13:23
  • @Bala I've seen and used solution with mod_rewrite on receiving end and preprocess functions on url generating end - and that's what I planned to post. But I'm perfectly open for other answers. – Mołot Sep 3 '13 at 13:24
  • 3
    @Mołot Marketing folks literally run from my desk when they come to me with that crap ;D – Clive Sep 3 '13 at 13:33
6

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/').

  • 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.
  • 2
    Yes, that's it! Nice! – Clive Sep 3 '13 at 13:31
  • Good catch :) I'll probably accept it, but post the manual way later anyway. – Mołot Sep 3 '13 at 13:34
  • 1
    Does this work with the CDN module? – mpdonadio Sep 3 '13 at 14:04
  • @Mołot what do you expect, I can't understand what you are asking about the manual way – Bala Sep 9 '13 at 8:15
  • 1
    @Bala it should. It usually does. But for the guy who inspired me post this question it was too buggy to use, and there is a way to do it without this module. That's all. But your answer is fine and upvoted by me all right :) – Mołot Sep 9 '13 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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