cpanel domain
Wordpress

How To Create Subdomain In cPanel & Install WordPress

If you want to have a subdomain on your website, it is an easy thing to do. I will show you how to create a subdomain in cPanel and then install WordPress on it.

It needs a little knowledge of how cPanel works and maybe a little techy task to do. But it is not hard. And you can install not only WordPress on a subdomain, but static HTML website too.



A subdomain is a great way to split your website into sections. For example, if you have a blog about pets, instead of pages, you can create a subdomain for different pets. And it is different from the page. It is like another website on the website.

Let’s say you want to create a page for dogs. Your website’s URL will be petsite.com/dogs. But when you create a subdomain in cPanel it will look like this – dogs.petsite.com.

So, it is like a subdivision of your website. And you can create as many subdomains as you wish. Check your hosting provider and see how many subdomains you can create. You can have different subdomains for different pages. Now, let me explain how to create a subdomain and install WordPress.


Create A Subdomain In cPanel

First, we need to go to cPanel and create a subdomain there. Go to your hosting account and there will be a link to cPanel. All hosting platforms may differ but it is not a hard thing to find it.

subdomain in cpanel

After you log in to your cPanel, find Subdomains under the Domains section, or use the search bar. Go there and here you can create a subdomain for your website.

create subdomain in cpanel

Insert your desired subdomain name, choose the domain you want to use, and click the Create button. That’s it. A new subdomain is created on your website.


Create SQL Database & User

You successfully created a subdomain in cPanel and it is time to create a database and user in order to install WordPress. Go back to the cPanel dashboard and search for MySQL Databases.

database in cpanel

Here you have to do three things:

  1. Create A Database
  2. Create An User & Password
  3. Add User To Database

Don’t forget to save the database name, user, and password somewhere, because you will need it later.

Go to Databases, choose a name and create your database.

create sql database

Scroll bellow and create new user and password.

create user

And then below choose the newly created database and user and click the Add button.

add user and databse

On the next page choose All Privileges and save changes. A new database and user are created and it is time for the next step.


Upload WordPress On A Subdomain

We created a subdomain in cPanel, database, and user. Now it is time to upload WordPress on it. Go to the WordPress website and download the latest version.

Then go to the File Manager from the cPanel dashboard and there you will see the newly created subdomain folder. Go there and upload the WordPress zip file you have just downloaded.

upload wordpress

Now, extract the zip file and then delete it.

extract wordpress

Then go to the folder where it was extracted, choose every file, and move it to a subdomain. Then delete the empty folder.

move wordpress

WordPress is uploaded and now it is time to connect it to your new database.


Connect Database To WordPress

Go where you extracted WordPress and rename wp-config-sample.php to wp-config.php. Now right-click on it and click Edit. Here you will need your database name, user, and password.

Find the lines you need and replace them with your names and password, click Save and it’s done. WordPress is connected to the database.

edit wp-config file

Now it is time for the final step.


Install WordPress

Now you can go to your new subdomain(test.wpsum.com in my case) and you should see this screen:

If you don’t, don’t worry. It may take 15-30 minutes for hosting to configure it. Or contact your hosting provider to solve the problem. But when you see that screen just follow the installation process.

Choose the language, site name, username, password, email. Install and that’s it. You have a fresh WordPress site. You can build pages, create posts, etc. You can use it as a test website or an additional page to your website.

Conclusion

As you can see, it was not that hard creating a subdomain in cPanel. Subdomains are a great way to create separate pages for your website. It can be a little website on the website.