How to create Multisite With cPanel with in 2 Minute

This is the fastest method I can think of to setup a Drupal Multisite with cPanel. No SSH required.

This page assumes the following

  • You know how to use cPanel
  • You know how to create a database user
  • You know how to create a database
  • You know what I mean when I say “yoursite.com” and “subdomain.yoursite.com”
  1. Install Drupal normally in the public_html folder.
  2. Go to the “Sub Domain Manager” in cPanel, create a subdomain. “subdomain.yoursite.com”
  3. Go to file manager and delete that folder cPanel has made for the subdomain.
  4. Create a folder in the /sites/ folder and name it “subdomain.yoursite.com”, replacing them with actual names.
  5. Copy “default.settings.php” file from /sites/default/ and paste it to the folder you’ve just made.
  6. Create a file in the same folder (The one you made) named “settings.php” and copy the code from default.settings.php.
  7. Create a PHP file in /public_html/ folder and put the code referenced below in it. Replace with real names.
  8. Visit the file with your browser by going to yoursite.com/yourfile.php

Reference & Notes
Note 1. yourfile.php – yoursite.com/yourfile.php

// This will create a Symlink without the need for SSH.
// Zip it and remove the file when done for safety!
// Please notice how it’s “subdomain” and not the full url.  This is important!
symlink( ‘/home/cPanel_User_Name/public_html/’, ‘subdomain’ );
?>

Note 2. When you browse /public_html/subdomain folder, it will loop. This is normal, do not delete the folder!
Note 3. You will want to edit your .htaccess file to redirect from yoursite.com/subdomain. If you don’t, and users visit yoursite.com/subdomain, it will show up as yoursite.com/subdomain/subdomain/ and it will loop. Additionally, if they visit let’s say “forum” from yoursite.com/subdomain/subdomain, it will show up as yoursite.com/subdomain/subdomain/forum, and this is very bad for SEO. Place this code into your .htaccess file and uncomment this – “# RewriteBase /”

# RewriteBase /
RedirectMatch 301 ^/subdomain/(.*)$ http://subdomain.yoursite.com/$1

Note 4. Don’t create any files in your subdomain folder, although it probably won’t hurt anything.
Note 5. When you visit subdomain.yoursite.com/subdomain, it will probably bring you to the home page. As good practice, don’t create any pages that will be named the same as your subdomain’s name.

This process can be done in under 2 minutes if you’re fast, and know how to do all the steps properly. To a new Drupal user, it shouldn’t take longer than 15 minutes. Hope you cPanel users found this information useful. If you need help with setting up a Drupal Multisite in cPanel (Although this guide makes it simple enough to do it yourself), I’d be glad to help. Use my Contact Form to get in touch with me. I don’t mind setting this up because it’s a simple process, and I think every lonely domain deserves a subdomain.