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 requires the basic knowledge of how cPanel works and maybe it is a little techy task to do. But it is not hard. And you can install not only WordPress on a subdomain, but a static HTML website too.
What Is A Subdomain
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. The standard URL will be petsite.com/dogs. But when you create a subdomain in cPanel it will look like this – dogs.petsite.com.
Also Read: How To Install WordPress On Your PC
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 subdomain creations it allows. You can have different subdomains for different pages.
How To Create Subdomain
First, we will create a subdomain on our website and then we install WordPress on it. This is a five-step process. Just follow the instructions and you will have a working WordPress website on a subdomain in minutes.
Step 1: Create A Subdomain In cPanel
First, we need to go to cPanel and create a subdomain there. Go to your hosting account dashboard and there will be a link to cPanel. All hosting platforms may differ but it is not a hard thing to find it.
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.
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.
Step 2: 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.
Here you have to do three things:
- Create A Database
- Create An User & Password
- 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 > MySQL Databases, give a name to a new database, and press the Create Database button.
Scroll below and create a new user and password for that database.
After that, scroll further and choose the newly created database and user and click the Add button. This will connect the user to the database.
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.
Step 3: Upload WordPress On A Subdomain
We created a subdomain in cPanel, a database, and a user. Now it’s 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.
Now, extract the zip file. You can delete the zip file after extracting the files.
After that, go to the folder where it was extracted, choose every file, and move it to a subdomain. Then delete the empty folder.
So, WordPress is uploaded on the subdomain and now it is time to connect it to your new database.
Step 4: Connect Database To WordPress
Go where you extracted WordPress and rename wp-config-sample.php to wp-config.php. Next, 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.
Now it is time for the final step.
Step 5: Install WordPress On A Subdomain
Now you type the subdomain URL in a browser (test.wpsum.com in my case) and you should see this screen:
If you don’t see it, don’t worry. It may take 15-30 minutes for the hosting to configure it. Or contact your hosting provider if you don’t see this screen. 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 do whatever you want on a subdomain. It is a separate website, independent from your main website. You can test new plugins and themes here.
For example, you have a business website or a blog and want to implement online store functions. You can create a shop on a subdomain. It will be separated from your main website.
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. You can have as many subdomains as you wish.