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

You Asked,
We made it!

fix japanese keyword hack

Step by Step Video Tutorials on trending topics in software development

Yes I am Curious »

AR in Websites – Top 3 Platforms for Bringing Augmented Reality to Your Web Experience

As technology advances, augmented reality (AR) is no longer limited to gaming or social media apps. Integrating AR into websites...

Know More »

Webhook Explained for Beginners: Everything You Need to Know

In the world of APIs, automation, and modern web applications, the term “webhook” often comes up. But what exactly is...

Know More »