You are here

Drupal 7 create subdomain multisite using cPanel

Submitted by Asif Nowaj, Last Modified on 2020-02-10

Let's suppose you already have a domain setup and running Drupal 7 code for your website and you manage your hosting using cPanel. As as example, let suppose a running website is a drupal 7 website and as a multisite that we wanted to create.

Below are the steps that I followed to achieve it.
1. Login to your cPanel and Go to "MySQL® Databases" options.
2. Create a new database let's say "anotherdb"
3. Add a new MySQL user like "anotherappuser" with a strong password.

4. Add user "anotherappuser" to database "anotherdb" with all privileges. All these steps are available in the same cPanel page of "MySQL® Databases".

5.Then go to the "Subdomains" in cPanel, create a subdomain. "".

6. Go to "file manager" and in your "/home/example/" directory, you will be able to see a folder called "", cPanel has made for the subdomain, delete this folder.

7. Go to within "public_html" folder then go to within "sites" folder, you will be able to folders like "all", "default". Create a folder with name "".

8. Copy "default.settings.php" and "settings.php" files from "/sites/default/" and paste it to the folder you've just made.

9. Open "settings.php" in edit mode and update the database configuration with new database name, db user and password and save it.

10. Go back to "public_html" folder and create a file called "createsymlink.php" and copy the following code and save it. Please change the names as per your setup.

symlink( '/home/example/public_html/', '/home/example/' );

11. Visit the file with your browser by going to "" once, there won't be anything fancy as output.

12. Now all the configuration is done, now visit "" and follow the onscreen instruction.

13. Once completed, browse "". Your site is ready.

Once the site is working do not forget to remove "createsymlink.php" that you have created.

Discussion or Comment

If you have anything in mind to share, please bring it in the discussion forum here.