Ok, this is the setting: A multisite setup with a (subfolder) site that lives in the following folders:

sites/mysite
sites/mysite/settings.php
sites/mysite/files
sites/mysite/modules
sites/mysite/tmp
sites/mysite/themes

The site is then accessed through http://www.example.com/mysite. In my file system settings (admin/settings/file-system) I set a files folder to be used, that's separated from the other sites:

sites/mysite/files

Now when I upload an image (or any other file), it gets a pretty long and ugly URL (even more with an image subfolder):

http://www.example.com/mysite/sites/mysite/files/image.jpg

It gets even weirder when I use imagecache (let's use the preset "250") to resize my images (imagine one or two subfolders more!):

http://www.example.com/mysite/sites/mysite/files/imagecache/250/sites/mysite/files/image.jpg

Are there any ways to get this a little nicer? I'd prefer something like http://www.example.com/mysite/files/image.jpg

Comments

zilla’s picture

pathauto module could beautify those url's - it automates the creation of url aliases...

yan’s picture

Hm, interesting idea. But is there a way to alter image paths or file paths in general using pathauto? It works for nodes, categories etc, but files? Haven't been able to find anything on that issue.

yan’s picture

To put it differently: Do all sites that run on a multisite setup have file paths that include sites/mysite? I don't think so, but I can't find a way to change it. Can this be achieved through a rewrite condition in .htaccess or httpd.conf?

EDIT: This might be helpful

yan’s picture

One solution I found through a more general discussion on file system issues is using symlinks. I set /files to point to /sites/mysite/files and /data to point to /sites/mysecondsite/files. The file system settings point to /files and /data. Another option is using symlinks like subfolders in /files (/files/mysite-alias --> /sites/mysite/files; /files/mysecondsite-alias --> /sites/mysecondsite/files).

That way I get nice looking URLs and I don't have problems with file paths when I change the domain (and therefore have to change the name of the folder /sites/mysite to /sites/mynewsite).

zilla’s picture

take a look at: http://drupal.org/project/type_local_nids

i think that's what you're looking for...

yan’s picture

Looks like an interesting module (actually I had been looking for something like this for a while), but I don't see what it has to do with file paths. As far as I understand lnid just works for nodes, but files are no nodes. Thanks anyways.

This patch could help with the multisite file system thingy, though.

rogerpfaff’s picture

i'm thinking about exactly the same issue right now.

i really would like the paths of the images / files not to show that there is a multisite installation. i think this is not a concern to anyone visiting one of the multisite pages.

if we are able to host files seperately for each site it should also be possible to show only the www.example.com/files/whatever/comes/next path and not an www.example.com/sites/example.com/files/and/so/on path.

------------------------------------------------------
Remember: I compute you!