A subdomain is an entirely different site to your primary domain. It is useful if your subdomain content is entirely different from original directory content. It also saves money because you don’t need to buy a new domain for your different content. For ex: google.com is a search engine while maps.google.com or mail.google.com are Maps and Emails website. Google built them on its subdomain because they are having a different niche than google.com.
Matt Cutt also said on this:
My personal preference on subdomains vs. subdirectories is that I usually prefer the convenience of subdirectories for most of my content. A subdomain can be useful to separate out content that is completely different. Google uses subdomains for distinct products such news.google.com or maps.google.com, for example. If you’re a newer webmaster or SEO, I’d recommend using subdirectories until you start to feel pretty confident with the architecture of your site. At that point, you’ll be better equipped to make the right decision for your own site.
Benefits of Subdomain
If you’re having a website of a different niche, then it is advised to use different subdomains for a different niche rather than having a separate subfolder for a different niche. Google also recommends focusing on just one niche on a single website. So if you have subdomains, then you can concentrate on the various niche. You can also make country-specific sites. For ex: If you’re having a news website, examplenews.com, you can post Indian News on in.examplenews.com, or US news on us.examplenews.com, etc. But we are here not to discuss benefits of subdomains but how to install WordPress on a subdomain. For installing WordPress on subdomains, we first have to create a subdomain for it. You can read my article below or watch my video on it.
How to create a subdomain?
First login to your cPanel account. Scroll down, find an option that says Subdomain and click on it(See the pic below):
Now you gave to name your subdomain. For ex: I called it ‘test.’ Then click on Create.
Then it must show a message saying “successfully created.”
Now we have to build Database for our subdomain. For creating a database, go back to cPanel home and click on MySQL Database Wizard.
Now name your database to whatever you like. I will call it to ‘test’. Then click on Next Step.
In the next step, you have to create User for controlling your database. Fill out the information needed. For any help in creating a user, See the pic below. After it, Click on Create user.
When the user has been created, In the next step you will see a message saying “You successfully created a MySQL user named ‘username’ .” You will see user and database info. Copy that info as we will use this information later.
Below that, you will have a table with some privileges. In this, you can select what privileges can the user (which you just created) can have. We will select “All Privileges“. Then click on Next Step.
Now you must see a successful message as shown below.
Now you have created a subdomain, database, and user for the database. In the next step, you want WordPress file for installing WordPress on your subdomain. For it, go to WordPress download page and download the .zip or .tar.gz file.
Now open your cPanel and go to File Manager. Then go to public_html > test (because this is my subdomain name). You will see the below file. It must be empty. Click on Upload for uploading WordPress File.
When the file is uploaded and extract the file. After it, you must see below pic.
You will see a file named wp-config-sample.php. You have to rename it to wp-config.php. After renaming it, Edit the file by right-clicking on it and click Edit.
Now, you have to write database name, username, and password.
Go to https://api.wordpress.org/secret-key/1.1/salt and copy the unique phrase(it looks something like below). These phrases are for security purposes so it is important to use them.
Paste your unique phrases in the section which says ‘put your unique phrase here.’
Installing WordPress on subdomain
Now when you have done pasting phrases, save the file and refresh the file manager. Now go to yoursubdomain.yourdomain.com/wp-admin/install.php for installing WordPress on your subdomain. For ex: in my case the URL is test.bloggerforever.com/wp-admin/install.php. Then fill all the information needed (you can take help from below pic). After filling all information click on “Install WordPress”.
Now you can see your WordPress dashboard.
Installing a WordPress on a subdomain is better than the subdirectory. It is good for your blog’s SEO. You can change the theme of different subdomains according to its content, type or category. You can comment below for any questions, feedback or suggestions, I’d be happy to read them. 🙂