Multisites on shared hosting

Submitted by Erik on Sun, 02/26/2012 - 18:43

I have been asked and seen some recent posts on folks having trouble setting up Drupal multisites on their shared hosting, specifically Dreamhost, Bluehost, etc. I figured it might be worth giving the basics for any hosting on how to get Drupal multisites to work.

Most ISP/hosting companies allow you to host multiple websites on a single account. Either separate as domains or "subdomains", you can host multiple websites on your account. Traditionally, two separate websites are served from separate directories. When two addresses point to the same directory (or in Apache httpd-speak) share a single DocumentRoot the websites serve the same files.

However, with Drupal multisites, this is exactly what happens and we want the same files to be served. Drupal's multisite capabilities happen within those files.

So the best thing you can do is to set up your first Drupal site as per the host's instructions. Then for the second site, don't set up a fully hosted subdomain. You want to set up the second domain as a "mirrored" domain (Dreamhost) or a "parked" domain (Bluehost).

You can set up multiple databases on either of these hosts as well, so don't reuse the same database for each multisite, you want to use separate databases.

In Dreamhost, visit your "Domains" secion and choose "Add New Domain / Sub-Domain". Skip the "Fully hosted" section and go straight to the "Mirrored" section. Fill in the name of your new domain/subdomain and then choose the original Drupal site from the drop down list.

In your Drupal web folder, create a sites/newdomain.mydomain.com (substituting your real domain/subdomain) and then copy the default.settings.php into that directory as settings.php. Now you should be able to visit http://newdomain.mydomain.com/install.php and proceed as a normal Drupal installation.

Comments

Kevin Schmidt (not verified)

Thu, 05/10/2012 - 03:47

Erik, I'm still not clear on how to configure multisites for Bluehost so that the new sites have separate domain names, and are not sub domains of the domain where the Drupal files are located.

For arguments sake, I have three domains that all begin with 'DomainName'.
They are 'DomainName.com', and two parked domains, DomainName.org, and DomainName.us.

I installed Drupal in 'DomainName.com', and created three separate MySQL databases.

How exactly should I create the new files and 'settings.php' in the 'public_html/domainname-com/sites' folder so that I can access the new multisite domains through web addresses DomainName.org and DomainName.us?

Thanks

Are the three sites meant to be different in anything but URL?
Assuming so, otherwise the answer is just "it should be all serving the same stuff already"

public_html/domainname-com/sites/default/settings.php
is the "main" site file, from what I gather. You should be able to create two more directories as:

public_html/domainname-com/sites/domainname.org
public_html/domainname-com/sites/domainname.us

And a copy of settings.php in each with the $db_url (Drupal 6) or $databases array (Drupal 7) set for each of the two extra databases.

Your article should clear this up for me. My first problem was the web hosting company I was using didn’t allow sub domains, so I was already confused there. Now the new web hosting company allows sub domains. That with your article, I should be able to work through this finally.

Add new comment

The content of this field is kept private and will not be shown publicly.

Filtered HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <img src alt height width> <pre>
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.