Integrated Tech Solutions

How to Serve WordPress Pages on Subdomains[without plugin]

By - Admin, Updated on August 22, 2021

What are Subdomains

Domains with prefixes like store or blog etc. followed by the main domain are called subdomains. These are used to serve different variants or services under the same domain but as a separate website.

https://blog.example.com

For example, if you have a business website example.com and you decide to sell products online later, You can create a subdomain like store.example.com apart from the main website.

What are different types of subdomains

Subdomains based on User Location – A website having https://ru.example.com for Russia and https://in.example.com for India.

Subdomains based on Language – Same website https://ru.example.com available in Russian language and https://ar.example.com available in Arabic.

Subdomain vs Subdirectories – what is different?

Crawlers like Googlebot consider Subdirectories as part of the domain and crawl them with the main domain. Whereas, Subdomains are considered as different websites.

How to Create Subdomain in Cpanel

Create Subdomain in Cpanel
Create Subdomain in Cpanel

Steps to Convert WordPress Page into Subdomain-

Get the Page Id of the page – Click on the Pages tab in the Dashboard. Then hover on edit below the page you want to serve on a subdomain, you’ll see the page_id in the bottom left corner as shown below-

How to get Page Id in WordPress

Now, open the file manager in Cpanel & open the directory created when you created the subdomain.

For example, if your subdomain is blog.example.com, the directory will be public_html/blog/

Create an index.php file in the subdomain directory & paste the code below.

Well Done!

Congratulations, you have successfully created a subdomain for a WordPress page.

Try opening the newly created subdomain in browser.
Initially, you might face a not-secure problem for a subdomain, to fix that you need to install an additional SSL certificate for it as shown in the video tutorial-

How to install a Free SSL Certificate in Cpanel

Read Our Most Popular Articles on WordPress Development

Keep Reading

👋 Hi, Find this Helpful? There is More

20 Most asked Odoo Interview Questions

Odoo Accounting Interview Questions

Know More »
shopify sections and blocks

How to create Custom Sections in Shopify[Dawn Theme]

Are you looking to customize your Shopify store beyond the standard templates and themes? Do you want to create unique...

Know More »
fix japanese keyword hack

Looking for Video Tutorials?

Explore Our Youtube Channel for in-depth Tutorials

Yes I am Curious »