Drupal 6 Multi-Site...Where Are My Images?

If you convert a Drupal site to a multi-site configuration, you will very likely notice a disturbing side-effect: your images no longer appear!

In a standard configuration, your images will likely be in the sites/default/files folder. Let's say that we have created a multi-site configuration, and our original domain is mysite. So, now we will have a directory of sites/mysite/files, to which we will move the images, and herein lies our problem.

Do Not Change the Files Directory Location on an Active Site

That is a primary rule, but, of course, changing to a multi-site configuration necessitates the sites/default/files directory of each site being moved to directory such as sites/mysite2/files, sites/mysite3/files, etc. The reason for the rule, and the reason for the problem, is that in Drupal 6, the file locations are kept in the database. Moving the files does not change the location already recorded for them in the database.

The result is that, for example, when imagecache creates a link for our file, what used to be

sites/default/files/images/image1.jpg

has morphed into the worthless

sites/mysite/files/sites/default/files/images/image1.jpg

The easiest way to repair this is:

  • export the files table from the database
  • use a text editor to alter the URL's (replace applicable occurrences of default with mysite, where mysite is your site name)
  • import the repaired table

You may find that the same action is required with the imagemenu table if you are using that module.

Remember to clear both your Drupal cache (admin/settings/performance) and your browser cache.

3 comments

by Roy (not verified) on Sat, 2011-07-02 04:57

I have a drupal 6 multisite setup on my local MAMP server. I don't want to upgrade these sites to drupal 7 as some of the modules have not been converted to drupal 7 yet. I would also like to start using drupal 7 on the MAMP server for new sites. However, I can't find a way to configure it so that both versions of drupal can run a multisite setup side by side (without interfering with each other).

Anyone done this with success? Any help appreciated...Roy

by Gisele (not verified) on Tue, 2012-06-12 23:32

I tried the SQL Export --> Find+Replace --> SQL Import for D6 single site to multisite migration and it works, but what about D7 ?
My D7 installation does not have a 'files' table, so I did a complete database dump and searched for sites/default/<FileName> and no luck locatiing a table.
Any ideas as to how the file location is stored in D7 ?
Thanks in advance!

by ayen on Fri, 2012-07-06 13:55

The files table is now file_managed in D7

©2005-2017 Ayen Designs. Underlying theme by Kiwi Themes.