Creating a subdomain in cPanel is a straightforward process, allowing you to create distinct web addresses within your existing domain. Subdomains are useful for organizing different sections of your website or creating specific areas like blogs, online stores, or forums. In this article, we’ll walk you through the steps to create a subdomain in cPanel.
What is a Subdomain?
A subdomain is a prefix added to your main domain, allowing you to create separate areas for your website without purchasing additional domain names. For example, if your main domain is `example.com`, a subdomain could be `blog.example.com` or `store.example.com`.
Prerequisites
– Access to your hosting provider’s cPanel account.
– An existing domain to create subdomains under.
Step-by-Step Guide to Creating a Subdomain in cPanel
1. Log into cPanel
– Access your cPanel account by navigating to `https://yourdomain.com/cpanel` and entering your login credentials..
2. Locate the Domains Section
– Once logged in, Search “domain” in the search bar or find the “Domains” section and click on “Domains”.
3. Create a New Domain
– Click the “Create A New Domain” button in the Domains interface.
4. Enter the Domain Name
– In the “Domain” text box, enter the subdomain name you wish to add as an addon domain (e.g., `blog.newsite.com`).
5. Document Root Option
– By default, cPanel will create a directory inside the `public_html` folder to store the files of the a subdomain. However, for a separate website, deselect the “Share document root (/home/username/public_html) with “domain.tld” option. This allows you to create a unique directory for your subdomain.
6. Directory Location
– You can either create the directory under the `public_html` folder, such as `/home/username/public_html/newsite`, or specify a directory outside of the `public_html` folder. For example, you can create a directory like `/home/username/newsite`, which will keep your subdomain’s files completely separate from your main website. This is a useful option for security reasons or when you want more control over the organization of your website files.
7. Submit
– After entering the domain and directory details, click the “Submit” button to add the addon domain.
Once the subdomain is created, you will see a success message.
To verify the subdomain is working, follow these steps:
1. Open your web browser.
2. Type in the newly created subdomain URL (e.g., `blog.example.com`) and press Enter.
If everything was set up correctly, you’ll either see a default page or a directory listing, depending on whether you’ve uploaded any files yet.
Manage DNS (If Needed)
In most cases, cPanel automatically handles the DNS settings for your subdomain. However, if your domain is registered elsewhere or managed by an external DNS provider, you may need to add a **DNS A Record** pointing your subdomain to the correct IP address.
Troubleshooting Tips
– Propagation Time: DNS changes may take some time to propagate across the internet. If your subdomain doesn’t work right away, wait a few hours and try again.
– SSL Certificates: If you’re using SSL on your main domain, consider installing an SSL certificate for your subdomain to secure it as well.
– Directory Permissions: Ensure that your subdomain’s document root has the correct file permissions for uploading and accessing files.
Conclusion
Creating a subdomain in cPanel is an easy and effective way to expand the functionality of your website. Whether you’re setting up a blog, a store, or any other section, subdomains provide flexibility and structure. By following the steps outlined in this guide, you can quickly create, manage, and utilize subdomains for your online projects.