Recently I decided to modify my configuration of Drupal 6. Previously, I had just one site, and I had innocently left everything in the default/ directory. This install in retrospect was easy but not an example of good planning. I later had to do some minor changes when I decided to migrate to multi-site.
When it later became clear that I wanted to host multiple sites, I had to move my 'files' directory from inside of /sites/default to /sites/central-america-forum.com. That was easy enough. I moved the settings.php file, cleaned the cache (I have devel module installed), fixed my hard-coded logo URL in my custom theme (oops) and it was running without a hitch.
except... I then realized that my modified installation hadn't properly transferred knowledge about the exact location of the images. Most images were not displaying - not Random Image block, not user thumbnails, etc.
So then I found some tips on Drupal: changing "files" directory configuration setting. No problem. I didn't even put the site in maintenance mode. I just backed up the db, fired off this sql: update files set filepath = replace (filepath, "sites/default/files", "sites/central-america-forum.com/files") ; and most images were back.
Except.. User thumbnails not showing up. So I fired up firebug for drupal (I had this module installed), and examined the queries for the user page ... eventually I realized 'duh' and just went to the database and did 'describe users' which made it clear that there was a 'pictures' field equivalent to the 'filepath' field... executed this sql update users set picture = replace (picture, "sites/default/files", "sites/central-america-forum.com/files") ; And it seems that everything is now working nicely. Of course the htaccess and robots.txt files are shared, which I might have to consider seriously in the future, but for now I think it's ok.
** NB - Update - January 1, 2010. I just received the following news about a drupal module that can help you automate this migration:
I just wanted to let you know that based on your post and experiences I've had of migrating sites in a mult-site setup I've created a module to make it much easier. I also wanted to add it to your post for other users who happen to find your blog post as I did when I was looking for an easier way to migrate.
http://drupal.org/project/sitedir_migrate
So in some ways this module was created thanks to you and your blog post!
-Andrew Riley
- peter's blog
- Add new comment
- 4456 reads
Full Google Feed
Digg
StumbleUpon
Propeller
Reddit
Newsvine
Furl
Facebook
Yahoo
Technorati
Icerocket
4 comments
I've decided to change my local install to multisite for the same reason, my configuration is this:
- wamp 2.0 with windows xp,
- my site's image and css are under /sites/files
so this is what I did:
1) changed the Administer > Site configuration > File system to /sites/ppe/files (previously it was pointing to /sites/default/files)
2) put D6 offline
3) updated the tables as instructed above (adjusting the file path of course, but oddly my files table is empty, showing 0 records, could it be? I assume I'm supposed to update the table in ppe, which is the table I created for my site, right? Sorry for this dumb question, I'm new to this). Even if I did not update the table, I should be able to see my site, right? I just won't be able to see the links to my images.
3) moved dir from /sites/default ==> /sites/newdomain (including settings.php then removed default dir as recommended)
4) brought D6 back online
5) went to localhost
and got the install page instead of my homepage.
Am I missing something here? Seems D6 did not recognize the new path in File system. Is there any other place that I have to change?
ps: D6 is still in the same location (/www/), I did not move it.
Thanks in advance,
Michael
Hi Michael,
I'll just take a wild guess - if you are running on your local machine, maybe you are specifying your URL something like: http://localhost:3004 to specify one domain, http://localhost:3005 for the other domain, etc... But apache might be telling drupal literally that the site is http://localhost:3004 - when you want it to say http://example.com - do you follow? So drupal looks in /sites/localhost:3004/* for the files, instead of /sites/example.com/* - you need to get apache to change the URL to http://example.com before passing it to drupal. Try adding something like this to your .htaccess file:
Listen 3004
Listen 3005
Listen 3006
<VirtualHost 127.0.0.1:3004>
ServerAdmin temp [at] temp [dot] com
DocumentRoot "c:/path/to/drupal/root"
ServerName example.com
</VirtualHost>
<VirtualHost 127.0.0.1:3005>
ServerAdmin temp [at] temp [dot] com
DocumentRoot "c:/path/to/drupal/root"
ServerName example-2.com
</VirtualHost>
<VirtualHost 127.0.0.1:3006>
ServerAdmin temp [at] temp [dot] com
DocumentRoot "c:/path/to/drupal/root"
ServerName example-2.com
</VirtualHost>
In one case I also had to specify the following directive inside the VirtualHost section for a particular site (I think that site was always going to the install screen, but I can't remember for sure) - you might also try it:
usecanonicalname on
Hi Peter, Trying to do this exact same thing, but not sure how to "execute an SQL". Can you explain in detail for a relative laymen like me how to accomplish this. Thanks.
I figured it out. Thank you so much for this. Really helped me out.