(gs):Drupal multi-site

  • This page was last modified on February 7, 2011, at 15:16.
The (mt) Community Wiki is a collaborative project. Any (mt) Media Temple customer or employee may contribute. Not all articles and/or content have been tested for accuracy by (mt) Media Temple.

For officially moderated and tested articles, be sure to visit our KnowledgeBase.

From (mt) Community Wiki

Drupal's multi-site feature allows you to administer multiple Drupal sites from the same Drupal installation.

This walkthrough is provided as a courtesy. (mt) Media Temple does not support configuring a Drupal multi-site installation.

Requirements

Instructions

  1. Sign into the AccountCenter.
  2. Add your second (or third, etc.) domain as an alternate domain. See Managing Domains for instructions.
  3. Log into your server via FTP. Navigate to the domains/ directory. Delete the folder for the domain name that you just added. (It should be empty except for a few empty folders inside it - if it has content, confirm that you don't need the content before deleting it!)

    If you do this step quickly enough, the server may not have automatically created the new folder yet. In that case, you can skip this step and proceed to the next one, although if you wait long enough, it will create the folder and you will have to remove it.

  4. Log into your server via SSH.
  5. Move into your domains/ directory:
    cd domains
    
  6. Execute the following command to link your second site to your first site. In this example, drupal1.com is the original site with the content, and drupal2.com is the new site that you want to link to the existing installation. You should replace these example domains with your own information.

    Create the symlink:

    ln -s drupalsite1.com drupalsite2.com
    

    If you ever need to remove this symlink from your server, you must do so through SSH. Follow Steps 2 and 3 again to connect to the server and enter the domains/ directory. Then run this command to unlink the site (example is for drupalsite2.com):

    unlink drupalsite2.com
    

    Do NOT delete the symlink through FTP, as this will delete all the content it is linking to as well!

  7. We're done with SSH now. You can close your Terminal or PuTTY window to exit the session.
  8. In FTP, navigate to domains/drupalsite1.com/html/sites/ and create a new folder for drupalsite2.com (replace with your own domain name).
  9. Copy domains/drupalsite1.com/html/sites/default/default.settings.php to domains/drupalsite1.com/html/sites/drupalsite2.com.
  10. Create a blank database for drupalsite2.com.
  11. Make sure you grant read and write access to that database for the same user that has access to your original Drupal site database. (Or, you can create a new user and modify your Drupal settings to use the new user instead.)
  12. If desired, modify your .htaccess file (domains/drupalsite1.com/html/.htaccess) to allow both www and non-www versions of your site. See the default Drupal .htaccess file for instructions. You can view your .htaccess file via FTP, as long as your FTP program is able to view hidden files and folders - consult your FTP program's help documentation if you are not sure how to do this. Or, you can use the File Manager tool in the AccountCenter.

That's it! You should now be able to maintain both of your sites through the same Drupal installation.