What is a subdomain and how do I create one?
Understanding Subdomains
A subdomain is a subdivision of your main domain name. For example, if your domain is example.com, then blog.example.com, shop.example.com, and mail.example.com are all subdomains. They are often used to organize different sections of a website, host separate applications, or point to third-party services like email or e-commerce platforms.
Subdomains are free to create and don't require registering a new domain. You can create as many as you need, limited only by your DNS provider's rules. Each subdomain can have its own DNS records, SSL certificate, and even be hosted on a different server.
How to Create a Subdomain
The exact steps depend on where your DNS is managed, but the process is similar everywhere. You'll log in to your domain registrar or DNS hosting dashboard, find the DNS management section, and add a new record. The most common record types for subdomains are A (which points to an IP address) and CNAME (which points to another domain name).
If you're using a web hosting control panel like cPanel or Plesk, you might also create a subdomain through that interface, which automatically adds the DNS record for you. In that case, you'll specify the subdomain name and the document root folder where its files will live.
- Log in to your domain registrar or DNS provider.
- Navigate to the DNS management or zone file editor.
- Add a new record: choose A (for IP address) or CNAME (for another domain).
- Enter the subdomain name (e.g., 'blog') as the host or name field.
- Set the value to the target IP address or domain name.
- Save the record and wait for DNS propagation (can take minutes to 48 hours).
After Creation
Once the DNS record is saved and propagated, your subdomain will resolve to the specified destination. If you're pointing it to a web server, you may need to configure that server to recognize the subdomain and serve the correct content. For HTTPS, you'll also need an SSL certificate that covers the subdomain, which can often be obtained for free via Let's Encrypt.
Keep in mind that subdomains are not automatically created when you register a domain. You must add them manually. Also, some DNS providers limit the number of records or require specific formats for the host field (e.g., using '@' for the root domain).
Common mistakes
- Thinking a subdomain is a separate domain that needs to be registered and paid for—it's actually free and part of your existing domain.
- Forgetting to update the web server configuration or SSL certificate after creating the DNS record, which can lead to errors or security warnings.
- Assuming subdomains propagate instantly; DNS changes can take up to 48 hours to be visible worldwide.
