Web Hosting - Subdomains

This article deals with setting up a subdomain on Webhosting. Typically, this is a subdomain that you run on the same service as the main domain. To set up a subdomain in DNS (for example, for a site on another provider), follow the DNS - Subdomains tutorial.

In this article you will learn:


Subdomains on Webhosting

You can create any number of subdomains with separate websites on the Webhosting with the main domain name. Make sure you meet the following conditions:

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

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


Create a subdomain via FTP

You can create subdomain sites via FTP in the www/domains or www/subdom folder. This option affects the behavior of subdomains relative to aliases. If you do not use aliases, we recommend using the www/domains folder.

For instructions on how to manage files via FTP, see 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 folder.
  4. Upload the site files, including index.html or index.php.

Subdomains in www/subdom

The sites in the www/subdom folder are common subdomains of all alias domains. You create a new subdomain here by creating a directory with the name of the subdomain itself without the domain extension. For example, on the domena.tld web host, you create a subdomain named shop.domena.tld by adding a folder named shop to the www/subdom folder.

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

Subdomains in www/domains

Sites in the domains folder are displayed only on the domain or subdomain (with or without www).

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

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

To create a subdomain with the application installer

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

To install the application on a subdomain, just enter the subdomain name between http:// and the domain name in the first step of the installation. For example, on the domena.tld web host, you create the subdomain store.domena.tld by entering the word store in 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

It usually takes up to 90 minutes to get HTTPS fully operational (activation and certificate signing).

To activate HTTPS on webhosting, follow the instructions Webhosting - Quick HTTPS Setup. Then follow the instructions Webhosting - Manual HTTPS Setup to enter domain and subdomain management.

Add subdomains to the certificate using the following 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 by clicking Add Domains at the bottom of the form.
Sample adding subdomains to Let's Encrypt web hosting certificate
Sample adding subdomains to Let's Encrypt web hosting certificate

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


Common problems

Common problems with managing subdomains on Webhosting include:

Error 500 on subdomain

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

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

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

Cannot create a subdomain folder with the installer

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

Cause: the installer detected an existing installation or remnants of an existing installation 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 site

Problem: The .htaccess file of my content management system is not compatible with the default .htaccess of WEDOS, so the subdomains do not work.

Cause: editing systems located in the www folder may override the .htaccess file with their own rules, or their rules may not be compatible with those in the default .htaccess.

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


Frequently Asked Questions

If I create a subdomain in both domains and subdomains, which will show up?

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

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

The default .htaccess file is found only in the www folder. You can have any .htaccess files in the subdomain folders. If any .htaccess file conflicts or if you enter a prohibited command, Error 500 will occur.

Where does a visitor who enters a non-existent subdomain go?

If the subdomain does not exist in the subdomains folder, the content from the www folder is displayed.

Did the instructions help you?

Thank you for your feedback!
Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors