tags:

views:

20

answers:

2

alias: admin/a/b

source: sites/all/modules/somemodule/somefile

I tried in menu, pathauto, they both report such source path does not exist or I don't have permission. How can this be achieved in most easy way?

+1  A: 

Url alias doesn't work with files, only paths that are known by Drupal (defined in the code/database).

Update:
Path aliases work by rewriting the url into something that Drupal understands. So if you wanted to make an alias to a file, you would need to serve the file yourself, since Drupal doesn't serve the files.
If you really wanted to, you could make a redirect to the file from, but that's not pretty.

googletorp
thanks!so can I add path to sites/all/modules/somemodule/somefile to menu?or in code?or not able to do this?
madcat
though can be done by adding an external link. but what if I don't want to use absolute base url in there. guess maybe should be done in code then
madcat
I've done this in the menu hook (given the link or use a callback and calling drupal_goto). extra works, but ok if already has the custom module...
madcat
A: 

Try setting the Download Method to private, under admin/settings/file-system. If you do, Drupal will serve your files and the redirects might work (I didn't test it myself... :-).

Naturally, this has a price in terms of performance. Your links will look different.

If you want to keep the public download method, your need to redirect in the HTTP server level, because file requests are not going through Drupal in that case.

zvikico

related questions