If you have a cPanel shared hosting account and want to use Drupal to host multiple sites, this article will help. By creating such a configuration, you can have on
These instructions are can be used with any cPanel based share hosting account. We assume you are hosting on a LAMP application stack (Linux, Apache, Mysql, PHP).
Before you begin, make sure you have the following system requirements:
If you don't want to go through the hassle of figuring out if your host meets Drupal requirements and wasting time troubleshooting, use Hostgator. This site happens to be on HostGator and is running Drupal multisites. I've used them throughout the years and they are affordably priced and very good on support.
If you sign up using Hostgator please use the banner above as we are a Hostgator affilliate. We use the ad revenue to run this website. And if you don't mind please contact me if you have done so. Thank you.
To make the explanations in this article easier to understand, assume site1.com is your main domain name and site2.com, site3.com, etc. are your other domains. Of course, substitute these with your real domain names.
We will start by creating our first domain.
(*) Note that it may take up to 24 hours before your domain name resolves as it needs to propagate across the Internet.
Go to cPanel and click on the php.ini QuickConfig icon. Make sure the following configurations are set:
Do NOT change $db_url to your database parameters of username/password/server/databasename as this will result in tables not being created. Just leave these files alone and let Drupal fill it in on install.
Take the original .htaccess from Drupal and modify the file to add the following:
Go to http://www.site1.com and you should be presented with the installation program. Fill in all the information as required and write down everything you entered to refer back later.
Make sure you test everything out to make sure it works.
Now that you have your main site installed, you can add additional Drupal sites! You basically do the same steps again.
(*) As you add more domains through cPanel site2.com, site3.com folders will be created. Delete them as they won't be used. You will see why below.
Here is the trick to creating Drupal multisites. Now that the siteN.com folder is deleted you must point siteN.com to the root public_html folder. On shared hosting accounts you don't have root access so you have to do it though programming.
Run your text editor and create a symlinkcreate.php file. Type the following in:
Replace username and siteN.com with appropriate information. FTP symlinkcreate.php to public_html and run it from your browser (http://www.siteN.com/symlinkcreate.php).
After execution, a folder by the name of siteN.com will exist. If you use your FTP client to access the siteN.com folder, it will point back at your public_html root.
The Apache httpd.conf is told that a siteN.com virtual host is available at /public_html/siteN.com directory. Every siteN.com HTTP request is file mapped to /public_html via the symlink. Because index.php is the default home file it will get executed. Index.php is Drupal's bootloader so all website requests to the symlinks will be handled by index.php. This is how a Drupal multisite can work.
Do the same instructions as mentioned above to add your new site to .htaccess for friendly URLs and site SEO.
Go to www.siteN.com and you should be presented with the installation for your siteN.com domain. Fill in all the information as required.
Congratulations! You are now done!
Proceed to add modules, setup users and all the other things you need to run your site. Refer to the Drupal documentation for assistance.