It has been nearly 2 years since I posted a question on Drupal.org forum about setting up my very first Drupal multisite.
My goal then was quite simple – I wanted to keep all Drupal codes in its’ own folder instead of keeping them directly under public_html folder. Reason? I wanted a clean install and I wanted to let my primary domain to use other platforms other than Drupal. Why? If Drupal is installed directly under /public_html, Drupal’s index.php will force my primary domain to become a Drupal site. Yeah, we could do redirection but that was way too much for me to grasp at that time.
22 replies later, I still didn’t get a clean way in achieving my goal – a Drupal multisite installation in “public_html/drupal” folder. I was getting all sorts of terms such as symlink, SSH, vhosts, PuTTY and tried those myself but I was nowhere near what I wanted. I was simply getting ever more confused.
In the meantime I continue building many sites and my favorite platforms were mainly Drupal and WordPress. I also moved my webhosting twice and doing new installations on a new server has taught a lesson or two. Thankfully, by time my understanding of the whole thing got better than when I first started and I finally able to crack that little multisite code.
It seems that the answer to my old puzzle lies in correctly using cPanel’s “Addon Domain” feature. Some techies advised against using cPanel but I am completely happy with it as it posed no problem up until now. The best part is – it’s easy and it works!
In short, here’s what I did in a few steps:
Just repeat steps 3 to 5 above for any more sites that you have.
As you can see, all URLs will end up at the same place i.e. “public_html/drupal”. However Drupal can tell the actual folder by looking at the URL entered and compare with domain name(s) defined in “drupal/sites/<domain name>” folder. So each URL will go to its’ actual folder to do whatever it was supposed to do.
Setting up sub-domain as part of a multisite configuration is no different than that of the top domain. I describe a similar process in this post.
Purposely I did not mention the part where you need to create your mySQL database as it is required by any Drupal installation. Also, you may or may not choose to use a common database shared across all your Drupal sites or otherwise - but that is another topic altogether.
As for myself, I only maintain a single set of Drupal codes for all of my Drupal sites. This makes my life a lot easier when it’s time to do updates, upgrades or even moving webhost.
On a different topic, I also run my WordPress sites using a single WP codes too. I shared how I did it in another article here. So I am like having two control centers where I manage all my Drupal and WP sites no matter how many of them. Adding a few more as I go along is a breeze. Life can’t be better than that, or can it?
Hope this helps you or someone out there. Enjoy.
Related article: