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, follow the instructions in the article DNS – Subdomains.
In this article, you will learn:
- Why set up subdomains on Webhosting
- How to create a subdomain via FTP
- How to create s subdomain via app installer
- How to set up HTTPS for subdomains
- Common issues
- Frequently asked questions
Webhosting Subdomains
On a Webhosting with a main domain name, you can create any number of subdomains for this domain (and possibly aliases). Check that you meet the following conditions:
- In the domain’s DNS records, you have type A (or AAAA) records with the name * or specific subdomains that direct to the Webhosting.
- You are using the default .htaccess file in the www folder, or have routing rules in the WEDOS directory structure at the end of your custom .htaccess.
- In the www folder on FTP, you have the domains and subdom directories according to the requirements of the Webhosting directory structure.
If the domain does not use our DNS, perform the check with the DNS server provider you are actually using.
Create Subdomain via FTP
You can create subdomain websites via FTP in the www/domains or www/subdom folder. This choice affects the behavior of subdomains in regard to aliases. If you do not use aliases, we recommend using the www/domains folder.
You can find instructions for file management via FTP in the article Webhosting – File Management.
Follow these steps to set up a subdomain via FTP:
- Log in to FTP via a client, such as WebFTP.
- Navigate to the www/subdom or www/domains folder.
- Create a new directory according to the instructions for that folder (see below).
- Upload web files, including an index.html or index.php file.
www/subdom Subdomains
Sites in the www/subdom folder are subdomains used by both the main domain and all alias domains. You create a new subdomain here by creating a directory with the name of the subdomain without the domain name. For example, to create the subdomain store.domain.tld on the Webhosting domain.tld, add a folder named store to the www/subdom folder.
www/domains Subdomains
Websites in the domains folder are displayed exclusively on that specific 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 itself. For example, to create the subdomain store.domain.tld on the Webhosting domain.tld, add a folder named store.domain.tld to the www/domains folder.
Create Subdomain via App Installer
If you use the app installer to build your site, you don’t need to create the subdomain folder manually on FTP. Just make sure it’s empty if it exists in www/domains (otherwise the installer will return an error).
To install the app on a subdomain, enter the subdomain name between the http:// field and the domain name in the first step of the installation. For example, to create the subdomain store.domain.tld on the Webhosting domain.tld, type store into the appropriate field.
HTTPS for Subdomains
It usually takes about 1 hour for HTTPS to be fully operational.
To activate HTTPS on the Webhosting, follow the instructions Webhosting – Quick HTTPS Setup. Follow the instructions Webhosting – Manual HTTPS Setup to enter the HTTPS domain and subdomain management interface.
Add subdomains to the certificate as follows:
- Click the Add Domains button.
- At the bottom of the form, write a comma-separated list of subdomains (without the main domain name).
- Confirm by clicking the Add Domains button at the bottom of the form.
If no error occurs, HTTPS should be active for subdomains within 1 hour.
Common Issues
Common issues with managing subdomains on Webhosting include:
- Error 500 on the subdomain
- App installer cannot create subdomain
- Incompatible main web .htaccess file
Subdomain Error 500
Issue: After creating a subdomain in the domains and subdom folder, the website displays an Internal Server Error message.
Cause: You must create a subdomain in either domains or subdom, not both.
Solution: Delete one of the conflicting folders in domains/subdom.
App Installer Fails to Create Subdomain
Issue: The app installer reports an error: The target directory /www/domains/sub.domain.tld is not empty.
Cause: The installer detected an existing installation or its remnants on FTP.
Solution: Login to FTP and delete the entire subdomain folder in the domains folder. Do not create a new one.
Incompatible Main Web .htaccess File
Issue: My content management system’s .htaccess file is not compatible with the default WEDOS .htaccess, so subdomains don’t work.
Cause: Content management systems located in the www folder may overwrite the .htaccess file with their own rules, or their rules are incompatible with those in the default .htaccess.
Solution: If you the problematic main site is in the www folder, move it to the www/domains/domsin.tld folder, where domain.tld is the main site’s domain. Then restore the default .htaccess file.
FAQ
Question: If I create a subdomain in both domains and subdom, what will be displayed?
Answer: Error 500 will occur. Choose one location for your subdomain and delete the duplicate subdomain.
Question: What should the default .htaccess file look like in the subdomain folder?
Answer: The default .htaccess file is only in the www folder. You can have any number of your own .htaccess files in subdomain folders. If there is any .htaccess file conflict or a forbidden command is entered, Error 500 will occur.
Question: Where does a visitor who enters a non-existent subdomain end up?
Answer: If the subdomain does not exist in the subdom or domains folder, the content from the www folder will be displayed.