Hallo.
I have my Drupal test installation located at drupal.mysite.com
With basic multisite setup I have created several sites within the sites folder:
- site-one.mysite.com
- site-two.mysite.com
- and so on
Obviously I want each of such subdomains to use its own files folder for storage, so, in site configuration -> file system, I set up the file system path to:
- sites/site-one.mysite.com/files
- sites/site-two.mysite.com/files
Now, everything works properly with each subdomain using his own files folder for imagecache presets and other assets
*BUT*
the URL of any given file, for example in site-one, is something like this:
http://site-one.mysite.com/sites/site-one.mysite.com/files/[FILENAME]
while the real (physical?) path is:
http://drupal.mysite.com/sites/site-one.mysite.com/files/[FILENAME]
and the URL shown to the public should be something like:
http://site-one.mysite.com/files/[FILENAME]
Although everything works properly, I find this situation quite strange and I am curious to know if this behavior is "by design" and if I can do something to let the correct path to show up.
Any clarification on the subject is really appreciated.
Thanks!
Comments
*_*
http://site-one.mysite.com and as such, will serve as a base url, the path of Drupal installation, and its always '/'
so, what is displaying in the path is correct.
Regards.
🪷 Beautifulmind
Thanks
thank you for the quick response.
So, you say that
http://site-one.mysite.com/sites/site-one.mysite.com/files
is the correct path?
I thought it should be
http://site-one.mysite.com/files
I think the problem is in the file system path settings where i set it as
sites/site-one.mysite.com/files
but if I just set it up to
files
It would point to the main installation:
http://drupal.mysite.com/files
I still cannot understand which setting I did misconfigure....
*_*
Well, you can give any names to your website but when you look for a particular stuff like 'files/', just look at 'sites/', whatever the path after that, use it to access 'files/'
Regards.
🪷 Beautifulmind
a bit clearer now
thanks beautifulmind.
I should have searched better in the docs:
http://drupal.org/node/53705
has all the info I need.
Cheers
Friendly file paths with multisites
Hi,
I agree that file paths which look like http://site-one.mysite.com/sites/site-one.mysite.com/files, are a pain. If you've got a bunch of uploaded images using paths like that, try moving the site to another domain (e.g. from dev to prod) and see what happens!
The solution I found to this was to configure the file system path settings to use the main files folder in the root of the Drupal and then use symbolic links to point back to an individual site's files folder. So, in the site's settings, I'd set the file path to 'files/site1' (using a short name to help distinguish sites, but keep the file path a manageable length). Then on the server...
/files <- Drupal's shared file folder
/files/site1 <- symbolic link to site one's file folder
/files/site2 <- symbolic link to site two's file folder
/sites <- Drupal's sites folder where the multi-site site live
/sites/site-one.mysite.com/files <- destination of the first symbolic link above
Your files and images are now accessible with URLs like http://site-one.mysite.com/files/site1/myfile.ext - which is no longer specific to a domain, and can be easily moved from dev to prod without links breaking, as long as you have the links setup on both servers.
Thanks, matkeane! I just
Thanks, matkeane!
I just learned something about that on
http://drupal.org/node/53705
But, since you've been so kind to suggest me to use symlinks.....can I ask if it's true that they can cause problems on shared hosting and to which extent?
Why would you suggest using them instead of .htaccess or editing settings.php as stated in the above book page?
Thanks in advance
Symlinks
Hi,
I have to admit, I don't think I'd seen that handbook page before now, so the main reason I'd been using the symlink solution was that I didn't know about the htaccess solution!
I think the problem with symlinks on shared hosting is that, quite often, you don't have shell access to create them, although you might be able (depending on your host) get around this by running the PHP symlink command to create them.
The advantage of symlinks is that it's relatively easy to point them somewhere else if the server setup changes (between local dev and prod sites, or if you move to a new host). Also htaccess files are fairly fragile, so that mistakes often end up with the dreaded 500 server error appearing instead of your site, so I prefer to keep changes to a minimum! Having said that, the htaccess solution is quite an elegant one, so I might give it a go...
I happen to have shell access
I have shell access (although on shared hosting), so while you give a try to the .htaccess solution, I'll learn how to set up symlinks. ;)
Thanks for your help!
cheers
HTAccess solution isn't working for me
In my local Windows multisite 6.12 installation, I tried what was suggested: I created a [Drupal root]/files directory, copied an .htaccess file into it, and added
When I tested it on example.local using a pathname of /files/myimage.jpg - nothing. Since, as you point out, moving from a dev environment (my local machine) to a production environment (remote host) would entail changing lots of pathnames...I'm left wondering what in heck to do.
What does work is setting up a /example directory within[Drupal root]/files. This is apparently not considered best practices, but I'm not sure why.
Files subfolder
Hi,
Not sure why the htaccess solution isn't working for you, but for your second point, about creating a subdirectory in /files/ - I think the main problem is that, to back up an individual site, you need to pull files from two different places in the Drupal file structure. If everything is contained in the /sites/example.com/ folder, it just makes life easier.
subscribing
subscribing
I am having an issue with the
I am having an issue with the Files folder. A new Files folder was auto-created in the root Drupal folder (I have no idea why), and all the files currently in sites/default/files are being ignored. Can anyone please assist?