How to Create Subdomains in cPanel
A subdomain is an extension of your primary domain name that allows you to create independent sections of your website without purchasing a new domain. Subdomains are commonly used for organizing large websites or separating different types of content. For instance, if you run a business website under example.com
, you might create subdomains like shop.example.com
for an online store or blog.example.com
for a blog.
By using subdomains, you can create a unique experience for users while keeping everything under your main domain. They are also useful for testing new features or creating regional versions of your website, like us.example.com
or uk.example.com
.
Why Use Subdomains?
Subdomains offer several advantages:
- Organization: Easily separate different sections of your website.
- SEO Benefits: Subdomains can rank independently on search engines, which could improve visibility for specialized content.
- No Need for New Domain: You can create new sections of your site without purchasing additional domain names.
Now, let’s go through the step-by-step process of creating a subdomain in cPanel.
Steps to Create a Subdomain:
-
- Start by logging into your cPanel account. To do this, open your browser and type
yourdomain.com/cpanel
in the address bar. - A login page will appear. Enter the username and password associated with your cPanel account and click "Log In."
- Start by logging into your cPanel account. To do this, open your browser and type
-
Locate the Subdomains Feature:
- After logging in, you will be taken to the cPanel dashboard. Here, you need to find the Domains section, which contains all domain-related settings.
- Click on Subdomains to access the subdomain management interface.
-
Create Your Subdomain:
- In the Subdomains section, you will see a form labeled "Create a Subdomain."
- In the Subdomain field, enter the name you want for your subdomain (for example,
shop
orblog
). - Next, select the domain you want to attach this subdomain to from the dropdown list if you manage more than one domain.
- cPanel will automatically generate the Document Root, which is the folder where all files for the subdomain will be stored. This path usually looks like
/public_html/shop
for a subdomain likeshop.example.com
. You can change this path if you wish, but it is recommended to keep the default unless you have specific reasons.
-
Finalize the Subdomain Creation:
- Once you've filled in the required fields, click the Create button.
- cPanel will now create the subdomain. This process might take a few moments, and once done, you’ll see a confirmation message that the subdomain has been successfully created.
-
Uploading Content to Your Subdomain:
- Your subdomain is now active, but it needs content. To add files, navigate to File Manager from the main cPanel dashboard or use an FTP client if you prefer.
- You will find a folder corresponding to your subdomain under the
public_html
directory (for example,/public_html/shop
). - You can upload HTML, PHP, or other types of files directly into this folder, and they will be accessible from the subdomain URL.
-
Testing the Subdomain:
- After uploading the necessary content, test your subdomain to ensure it’s working properly.
- Open a web browser and enter the subdomain URL (for example,
shop.example.com
). If everything was set up correctly, the browser should display the content you uploaded. - If the subdomain is not yet visible, it may take a few minutes for DNS settings to propagate. You can also try clearing your browser’s cache or checking your DNS settings if there are issues.
Managing Your Subdomain:
- Once the subdomain is created, it functions like any other part of your website. You can manage files, install scripts, or even set up a separate content management system (CMS) like WordPress specifically for the subdomain.
- Additionally, subdomains have their own directory and database configurations, allowing you to keep them entirely independent from the main domain.
When to Use Subdomains:
- Business Expansion: If you're planning to expand your business offerings, creating a subdomain like
store.example.com
can separate your e-commerce section from your informational site. - Regional Websites: If your business operates in multiple countries, using subdomains like
us.example.com
oruk.example.com
helps localize the content for each audience. - Testing Environments: You can use subdomains like
test.example.com
to develop and test new features without affecting the live website.