CS · EN

Webhosting - Subdomains

This article addresses subdomain setup on Webhosting. Typically, this is a subdomain that you operate on the same service as the main domain. To create a subdomain in DNS (for example for a website with another provider), follow the instructions in the article DNS – Subdomains.

In this article, you will learn:


Subdomains on Webhosting

On Webhosting with the main domain name, you can create any number of subdomains with separate websites for this domain (and possibly aliases). Make sure that you meet the following conditions:

Sample DNS records with the main domain and all subdomains pointed to the same Webhosting
Sample DNS records with the main domain and all subdomains pointed to the same Webhosting

If the domain does not use our DNS, check it with the DNS server provider you actually use.


Creating a subdomain via FTP

You can create subdomain websites via FTP in the www/domains or www/subdom folder. This choice affects how subdomains behave in relation to aliases. If you do not use aliases, we recommend using the www/domains folder.

Instructions for managing files via FTP can be found in the article Webhosting – File management.

To create a subdomain via FTP, follow these steps:

  1. Log in to FTP, for example via the WebFTP ⧉ client (Manual).
  2. Enter the www/subdom or www/domains folder.
  3. Create a new directory according to the instructions for the given folder.
  4. Upload the website files, including index.html or index.php.

Subdomains in www/subdom

Websites in the www/subdom folder are shared subdomains of all alias domains. You create a new subdomain here by creating a directory named after the subdomain itself without the domain suffix. For example, on the domena.tld Webhosting you create the subdomain obchod.domena.tld by adding a folder named obchod to the www/subdom folder.

Sample subdomain obchod.wds-test.cz created in the subdom directory
Sample subdomain obchod.wds-test.cz created in the subdom directory

Subdomains in www/domains

Websites in the domains folder are displayed exclusively on the given domain or subdomain (with or without www).

You create a new subdomain here by creating a directory with the full domain name including the domain suffix. For example, on the domena.tld Webhosting you create the subdomain obchod.domena.tld by adding a folder named obchod.domena.tld to the www/domains folder.

Sample subdomain obchod.wds-test.cz created in the www/domains directory
Sample subdomain obchod.wds-test.cz created in the www/domains directory

Creating a subdomain using the application installer

If you use the application installer to create a website, you do not need to create the subdomain folder manually on FTP. Just make sure that if it exists in www/domains, it is empty (otherwise the installer will return an error).

To install an application on a subdomain, simply enter the subdomain name in the first step of the installation between http:// and the domain name. For example, on the domena.tld Webhosting you create the subdomain obchod.domena.tld by entering the word obchod into the field between http:// and  domena.tld.

Sample subdomain obchod.wds-test.cz created using the application installer
Sample subdomain obchod.wds-test.cz created using the application installer

Setting up HTTPS on a subdomain

Complete HTTPS activation (certificate activation and propagation) usually takes up to 90 minutes.

Activate HTTPS on Webhosting according to the instructions Webhosting – Quick HTTPS setup. Then, according to the instructions Webhosting – Manual HTTPS setup, go to domain and subdomain management.

Add subdomains to the certificate using this procedure:

  1. Click the add domains button.
  2. At the bottom of the form, enter a list of subdomains (without the main domain name) separated by commas.
  3. Confirm the addition with the add domains button at the bottom of the form.
Sample addition of subdomains to the Webhosting Let’s Encrypt certificate
Sample addition of subdomains to the Webhosting Let’s Encrypt certificate

If no error occurs, HTTPS will be active for the subdomains within 1.5 hours.


Common problems

Common issues with managing subdomains on Webhosting include:

Error 500 on a subdomain

Problem: After creating a subdomain in both the domains and subdom folders, 500 Internal Server Error is displayed.

Cause: You must create the subdomain either in the domains folder or in the subdom folder, not in both.

Solution: Delete one of the conflicting folders in domains/subdom.

Cannot create a subdomain folder with the installer

Problem: The application installer reports an error: The target directory /www/domains/sub.domena.tld is not empty.

Cause: The installer detected an existing installation, or remnants of one, on FTP.

Solution: Log in to FTP and delete the entire subdomain folder in the domains folder. Do not create a new one.

Incompatible .htaccess of the main website

Problem: The .htaccess file of my CMS is not compatible with the default WEDOS .htaccess, and subdomains therefore do not work.

Cause: Content management systems placed in the www folder may overwrite the .htaccess file with their own rules, or their rules are not compatible with those in the default .htaccess.

Solution: If you have a problematic main website in the www folder, move it to the www/domains/domena.tld folder, where domena.tld is the domain of the main website. Then restore the default .htaccess.


Frequently asked questions

If I create a subdomain in both domains and subdom, which one will be displayed?

A 500 Error will occur. Choose one location for your subdomain and delete the duplicate subdomain.

What should the default .htaccess file in the subdomain folder look like?

The default .htaccess file is located only in the www folder. In subdomain folders, you may have any .htaccess files. If there is any .htaccess file conflict or a forbidden command is entered, a 500 Error will occur.

Where will a visitor go if they enter a non-existent subdomain?

If the subdomain does not exist in the subdom or domains folder, the content from the www folder will be displayed.