Drupal Multisite Configuration via Subdirectories

Tagged:  

If you have a basic Drupal web siteinstalled in the root directory on your webserver and you want to set up a new website in a subdirectory, with its own themes and module settings, here is how I do it.

 

Applies to Drupal 6.X:

  1. Back-up everything: your database (e.g., using the Drupal Backup and Migrate module) and your Drupal files.
  2. Create a folder on your local PC with a name something like /mysite.com.mynewsubsite. [note the weird syntax!]
  3. Using FTP, download the entire contents of your webserver's /sites/default directory into the directory you just created.
  4. In the settings.php file in the new directory, change the database prefix to something suitable for your subsite, for example:

    $db_prefix = 'mynewsubsite_';
     
  5. Upload the whole /mysite.com.mynewsubsite directory (or whatever you have called it) to the webserver's /sites directory. You should now have a directory structure on your webserver that looks like this:

    www.mysite.com/sites/default/
    www.mysite.com/sites/mysite.com.mynewsubsite/

  6. Create a text file called makesymlink.php containing this text:

    <?php
    symlink
    (".", "newsubsite");
    print
    "Done";
    ?>
  7. Upload makesymlink.php to the root directory of your webserver.
  8. Run makesymlink.php by going to http://www.mysite.com/makesymlink.php in your browser. The script will run and "Done" should be displayed in your browser.
  9. Delete makesymlink.php from your webserver.
  10. Go to www.mysite.com/newsubsite/install.php in your browser.
  11. Now you can set up the new site.