How To Create a Subdomain

How to Create a Subdomain

Overview

A subdomain is an additional address that uses your existing domain.

For example, if your main website is:

example.com

you could create:

blog.example.com

shop.example.com

or:

support.example.com

Subdomains can be used for separate websites, applications, testing environments, landing pages, or other services.

If your domain is hosted with Have Freedom Hosting, you can create and manage subdomains through cPanel.


Before You Begin

Before creating a subdomain, decide:

  • What you want the subdomain to be called

  • What you want it to be used for

  • Where its website files should be stored

  • Whether the subdomain needs its own DNS configuration

For example:

blog.example.com

could be used for a blog while:

example.com

continues to serve your main website.


Creating a Subdomain in cPanel

If your hosting account has the Domains feature enabled, you can create a subdomain through:

cPanel → Domains

Depending on your cPanel version and hosting configuration, subdomains may be managed through the main Domains interface rather than a separate "Subdomains" tool.

To create one:

  1. Log in to cPanel.

  2. Open Domains.

  3. Select Create A New Domain or the appropriate option for adding a domain.

  4. Enter the subdomain you want to create.

  5. Review the document root.

  6. Save or submit the new domain.

For example, you might enter:

blog.example.com

cPanel will then create the domain/subdomain configuration for your account.


Choosing the Document Root

The document root is the directory where the website files for the subdomain are stored.

For example:

public_html/
├── index.html
└── blog/
    └── index.html

In this example:

example.com

could use:

public_html/

while:

blog.example.com

could use:

public_html/blog/

The exact document root you should use depends on how you want your website organized.

If you are creating a completely separate website, giving it its own directory is usually the simplest approach.


Uploading Website Files to Your Subdomain

Once the subdomain has been created, you can upload its website files into the assigned document root.

You can use:

  • cPanel → Files → File Manager

  • FTP or another supported file-transfer method

For example, if the subdomain uses:

public_html/blog/

its website files should be placed inside that directory.

You might end up with:

public_html/
└── blog/
    ├── index.html
    ├── images/
    └── css/

When someone visits:

blog.example.com

the server will use the files associated with that subdomain's document root.


Using a Subdomain With WordPress

A subdomain can also be used for WordPress.

For example:

blog.example.com

could have its own WordPress installation separate from the main website.

If you're using Softaculous, select the appropriate domain when installing WordPress.

Make sure you select the subdomain rather than accidentally installing the application into your primary domain.


Does a Subdomain Need a DNS Record?

When a subdomain is created through cPanel, cPanel will normally configure the necessary local DNS information when your domain's DNS is managed by the hosting account.

You generally shouldn't need to manually create another DNS record simply because you created a subdomain through cPanel.

However, there are situations where a subdomain needs to point somewhere other than your hosting account.

For example:

status.example.com

might point to a third-party monitoring service.

In that situation, the DNS configuration may need to be handled separately using Zone Editor.


Using Zone Editor With a Subdomain

If you need to manually configure DNS for a subdomain, you can use:

cPanel → Domains → Zone Editor → Manage

Select the appropriate record type and enter the information provided by the service you're connecting.

For example, a third-party service might instruct you to create:

Type: CNAME
Name: status
Target: service.example-provider.com

Follow the instructions from the service you're connecting rather than guessing the DNS values.


Subdomains and HTTPS

If your subdomain is going to be accessed through HTTPS, it will need appropriate SSL coverage.

For example:

https://blog.example.com

The SSL configuration needs to cover the subdomain.

If your hosting account uses automatic SSL provisioning, the certificate may be issued automatically once the domain and DNS configuration are correct.

If HTTPS isn't working, check the SSL-related tools available in cPanel and verify that the subdomain is correctly configured.


Testing Your Subdomain

After creating the subdomain and uploading your website, open it in a browser.

For example:

https://blog.example.com

Check that:

  • The correct website loads.

  • Images and other resources work.

  • Links work correctly.

  • HTTPS works.

  • The subdomain isn't displaying an unexpected page.

  • Your files are in the correct document root.

If you just created the subdomain, give DNS and SSL provisioning some time before assuming something is wrong.


Common Problems

"My Subdomain Doesn't Load"

Check that:

  • The subdomain was created in cPanel.

  • The document root is correct.

  • Your website files are in that directory.

  • Your domain's DNS is managed by the appropriate provider.

  • The subdomain's DNS configuration is correct.

If you recently changed DNS or nameservers, propagation may also be involved.


"I Created the Subdomain but See a Blank Page"

Make sure there is actually a website in the subdomain's document root.

For a basic HTML site, you would normally expect an index file such as:

index.html

For an application such as WordPress, verify that the application was installed in the correct location.


"My Main Website Changed"

If creating the subdomain appears to have affected your main website, check the document root assigned to the subdomain.

The subdomain should not normally use the same document root as your primary website unless you have a specific reason to configure it that way.


"HTTPS Doesn't Work"

Verify that:

  • The subdomain resolves correctly.

  • The DNS configuration is correct.

  • An appropriate SSL certificate is available.

  • The website is actually configured to use HTTPS.

If your hosting account uses automatic SSL, certificate issuance may take some time after the subdomain becomes available.


Subdomain vs. Subdirectory

You may also be deciding between a subdomain and a folder.

For example:

Subdomain:

blog.example.com

Subdirectory:

example.com/blog/

These are not the same thing.

A subdomain is configured as a separate hostname and can have its own website or application.

A subdirectory is simply a folder within an existing website.

Which option is better depends on how you want your website structured.

If you're simply creating another section of the same website, a folder may be all you need.

If you're creating a separate website or application, a subdomain may make more sense.


Removing a Subdomain

If you no longer need a subdomain, you can manage it through:

cPanel → Domains

Be careful when removing one.

Removing the domain configuration does not necessarily mean that every file associated with it should be deleted.

If you have important website files in the subdomain's document root, make sure you have a backup before deleting anything.


Need Help?

If you're unsure whether you should use a subdomain, where its files should go, or how it should point to another service, contact Have Freedom Hosting Support.

When asking for help, tell us:

  • Your main domain

  • The subdomain you want to create

  • What you want to use it for

  • Whether it will host a website or point to another service

  • Whether you've already created it in cPanel

That information will help us determine the best way to configure it.

 

  • 0 A felhasználók hasznosnak találták ezt
Hasznosnak találta ezt a választ?

Kapcsolódó cikkek

Understanding Domain Names and DNS Records

Understanding Domain Names and DNS Records Overview Your domain name is the address people use...

How to Change Your Domain's Nameservers

How to Change Your Domain's Nameservers Overview When you purchase hosting from Have Freedom...

How to Add or Change a DNS Record

How to Add or Change a DNS Record Overview DNS records control where different parts of your...

How to Redirect a Domain or URL

How to Redirect a Domain or URL Overview A redirect automatically sends visitors from one web...

How to Check and Troubleshoot Your Domain's DNS

How to Check and Troubleshoot Your Domain's DNS Overview DNS (Domain Name System) is...

Powered by WHMCompleteSolution