RationalDev

more of an aspiration than a claim

Drupal Multi-site Configuration Tips

I run multiple Drupal sites. These mainly use the same code base, but I still use links for files and directories in Drupal so I have flexibility.

Some advantages are:

  • I can update one website at a time and easily switch back and forth between versions. Maybe one site cannot be upgraded because one of its modules hasn’t been updated to the latest code version yet.

  • I can point any directory in the Drupal installs to somewhere different, eg they all have their own image directories, I can link to different robots.txt files.

I made a script I call createDrupal.sh which I run in the Drupal directory I am updating. createDrupal.sh looks a bit like the following (note, I have the full path of my home directory and not a ~ in my script, so I am not sure this works):

unlink robots.txt
ln ~/$1/robots.txt robots.txt
unlink xmlrpc.php
ln ~/$1/xmlrpc.php xmlrpc.php
unlink php.ini
ln ~/$1/php.ini php.ini
unlink update.php
ln ~/$1/update.php update.php

unlink includes
ln -fs ~/$1/includes includes
unlink misc
ln -fs ~/$1/misc misc
unlink modules
ln -fs ~/$1/modules modules
unlink scripts
ln -fs ~/$1/scripts scripts
unlink sites
ln -fs ~/$1/sites sites
unlink themes
ln -fs ~/$1/themes themes
unlink database
ln -fs ~/$1/database database