Thursday, October 25, 2007

Multisites with a subdomain

This is very similar to the above, but I am repeating the steps just to be sure..

  • Using PHP MySQL or any other database application, create a database by the name "subdomain"
  • Grant full privileges to the database to the default user
  • Using phpMyAdmin, create the tables and default data in your database by suitably modifying the drupal database file ("database.sql").
  • Using cPanel or ftp, create a sub-directory in the "/sites" directory called "subdomain.domainname.tld"
  • Copy the /sites/default/settings.php to the new directory /sites/domain2.com/settings.php
  • Make changes to the following line in the new settings.php file
    $db_url = 'mysql://db-username:db-password@localhost/new-db-name';
  • Create a symlink from the new location to the main site, using the command (for example):
    ln -s /home/username/public_html/
    /home/username/public_html/subdomain

    Here, I am assuming your webhost has redirected your subdomain to your "/subdomain" folder of your main account. In this example, the url http://subdomain.domainname.tld should resolve to the physical folder /home/username/public_html/subdomain on your server (or shared server).

If you don't have shell access and your webhost does not support creating symlinks, try out the symlink() function in php. Here is a step by step guide to using symlink function if you dont have shell access. Note that for this to work, it is necessary to delete the physical folder "/home/username/public_html/domainname2" from your web server, as the link created by symlink() is only symbolic and not actual. The article explains that in detail.

  • Now access your new subdomain name at the address http://subdomain.domainname.tld
  • Create your first user account, which should be the admin user!

  • *This post was not yet tested by me.

    Original Post: http://drupal.org/node/107347

    1 comment:

    Wow Gold said...

    Randy Run has the contacts to first-class pro gamers, who not only supply your daily dose of WoW gold, but also offer interesting level services like WoW powerleveling, Wow profession levelling and WoW PvP levelling.