Drupal Multisite on Bluehost
The following outlines my setup of Drupal in a multisite fashion on the webhost Bluehost. This lets you serve sites from one Drupal codebase with each site having its own database, domain name / URL, and themes/modules/file store. You can even go a step further with Bluehost and allow different people FTP access to just their Drupal site.
1) Get a Bluehost account. There's lots of variables here: some people use Bluehost as their registrar, others keep their registrar just for hosting, others use a separate DNS, etc. Whatever you have will be fine, just enable SSH.
2) Extract Drupal:
ssh account@domain.name
cd www
wget http://ftp.drupal.org/files/projects/drupal-5.7.tar.gz
tar xzvf drupal-5.7.tar.gz3) Create a handy shortcut to make paths and upgrades easier:
ln -s drupal-5.7 dThis will let you refer to your Drupal root path as: /home/account/www/d/
4) Setup the .htaccess with the necessary rewrite. This means anyone who goes to youdomain.name will actually get content served to them out of the "d", aka "drupal-5.7" directory. To do this, add the following to /home/account/www/.htaccess:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /d/$1 [l]
RewriteRule ^index.html$ /d/ [l]The above assumes you want the root of your HTML directory to be the root of the Drupal site. If you want Drupal in a subdirectory then just don't use the rewrite code and your Drupal URL will be http://domain.name/d/. If you want Drupal at the root but still want to add non-drupal subfolders or aliases, you have two options. To redirect for all your domains on your account, add this to .htaccess:
Redirect /blah http://someothersite.comIf you want to do redirects for only some of your domains, put the following ABOVE your rewrite code in the same .htaccess file:
RewriteCond %{HTTP_HOST} ^domain.name$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.name$
RewriteRule ^mail$ http://someothersite.com [R=301,L]5) Create your "default" Drupal database. Login to your Bluehost cPanel. Do the MySQL DB Wizard and create the DB and user. Give the user All Privileges. When selecting a database name, your account name will be prepended to it so choose something descriptive but short.
6) Now edit www/d/sites/default/settings.php, changing a couple things:
$db_url = 'mysql://account_dbuser:password@localhost/account_dbname';
$base_url = 'http://domain.name';
ini_set('session.name', "yoursitename");7) You should be all ready now to setup your first (main) Drupal site. Go to http://domain.name/install.php and take it from there!
8) To add another Drupal site at its own domain name, first go to its registrar and set it to Bluehost's DNS:
ns1.bluehost.com
ns2.bluehost.comIf you need to have control over the DNS entries for your domain, instead of the above you'll want to keep DNS where it is and set an A record for the domain name to point to your Bluehost IP.
9) Create a new database and user and assign the user All Privileges on the database. Just like you did in step #5.
10) Create a subdirectory for your site under Drupal's "sites" folder by copying and editing the default site.
ssh account@domain.name
cp www/d/sites/default www/d/sites/newdomain.name -r11) Edit the new site's settings.php file like you did in step #6, to match the dbname and user you made for this new site.
12) Now go to your Bluehost cPanel, Domain Parking, and park the domain name. If you're using your own registrar, don't let it fool you into thinking you have to change. You just want to park the domain at your Bluehost account.
13) Go to http://newdomain.name/install.php and you should be all set.
14) Repeat steps 8-13 anytime you want to add another Drupal website with its own domain name.
15) To add a unique Drupal site in a sub-path of any domain name, first create the database like you did in step #9/#5.
16) Then create the Drupal subdirectory. The format must be domain.name.sub-pathname. For example, if you wanted http://school.com/physics to be it's own Drupal site, the subdirectory you create would be "school.com.physics":
ssh account@domain.name
cp www/d/sites/default www/d/sites/school.com.physics -r17) Edit the settings.php file like in step #11/#6. Make sure to use the correct $base_url.
18) Lastly, make a link in the Drupal sites directory with the name of the sub-path. It must match the last part of the folder name you created in #16. So, for our http://school.com/physics example:
ssh account@domain.name
cd /home/account/www/d
ln -s /home/account/www/d physics19) Go to http://domain.name/subfolder/install.php and you should be all set.