• bezpečný...
  • stabilný...
  • rýchly!

How to Enable Creation of Automatic Subdomains

section: Support

Webhosting from Platon Technologies enables you to automatically create subdomains on your domain; you only need to create a folder with the name of the desired subdomiain in the SFTP space of the respective domain.

This functionality is not enabled by default. Some initial setup is required before its launch, which can be accompanied with a short outage of your domain.

Therefore before enabling subdomains, we ask you to carefully read this manual to the end, to comply with the sequence of steps and consult any ambiguities with us. The actual activation of subdomains in our system is done on our side, so we kindly ask you to let us know about the need to activate automatic subdomains in time so that we can agree upon concrete time of the activation.

In principle, creating subdomains is based upon the fact that thanks to the special A record in the form *.yourdomain.ext each folder created in the SFTP space of the respective domain is considered to be a subdomain. So once you create a folder, a subdomain in the form foldername.yourdomain.ext is created and the aforementioned A record will take care of the subdomain’s correct pointing.

Naturally, by setting the A record, the default records www.yourdomain.ext and yourdomain.ext will be disabled. Without realizing the following measures, this would disable your domain (displaying its current content).

With the aim of minimizing the time your domain is unavailable, we recommend to apply the following procedure:

  1. 1. Create special folders in SFTP (www/ a _/)
  2. 2. Copy the contents to www/ and create redirect
  3. 3. Create an A record *.yourdomain.ext
  4. 4. Enable automatic subdomains

1. Creating Special folders in SFTP (www/ and _/)

As it has already been mentioned, by enabling the creation of automatic subdomains every folder in SFTP will become a subdomain. This means that it is necessary to create also folders for default domain forms – in the SFTP space of the respective domain (in the folder web/yourdomain.ext/). You need to create two special folders here:

www – for the format www.yourdomain.ext and _ (underscore) – for the format without www

(When creating the folder DO NOT type the slash symbol at the end}

2. Copying the content to WWW and creating redirect

The folder www/ (web/yourdomain.ext/www/) will replace the previous main folder (web/yourdomain.ext). The content of the SFTP space (domain) needs to be moved here. The folder _/ is created for the record without www (so its content will appear when you type in the browser your domain name without www.) Naturally the content of this folder is usually identical with www so you should copy the same content as to the folder www/. This would, of course, require a lot of unnecessary work and complicate the update of your site. Instead, you can redirect the folder _/ to the folder www/ with the following steps:

In the folder _/ create a file named .htaccess (without suffix, with a dot at the beginning of the name). Copy the following code and paste it to the file:

 # This is universal permanent HTTP redirector created by Platon Technologies
 # for multihosting and auto-subdomains purposes.
 # Should be placed into _/ subdirectory in virtual document root.
 # Actual website content goes into www/ subdirectory.

RewriteEngine on RewriteBase / RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

Once the file is saved, the automatic redirect of the domain is set to the www/ folder, where the domain’s content is stored.

Please note one more important thing: When copying the content of the website into the www/ folder, the website code must be adapted to this fact, meaning that all fixed paths to files that previously went to public_html / domain.ext should be adjusted so that the path to the files in the code is updated.

3. Creating an A Record *.yourdomain.ext

It is now necessary to edit an A record that will redirect subdomains to your SFTP space. The A record is created or edited on our web portal https://setup.platon.sk/ First log in and in the section DNS click on Domain List and select the respective domain.

The list of A records of the domain is at the bottom of the screen.

After clicking on edit (pencil) left to A record www.yourdomain.ext Edit record , change "www" to * (asterisk symbol) in the line Name. IP address in line Content should remain unchanged

4. Enabling Automatic Subdomains

Everything is now ready for enabling automatic subdomains. You can enable automatic subdomains by editing virtualhost yourdomain.ext and checking box "enable automatic subdomains". Else, please contact us with this request, and we will activate the functionality as agreed. As soon as we activate automatic subdomains in our system, we will delete the www record from A records in the domain’s DNS. If at this point the content of your website was not copied in the new folder www/ and the redirect was not set up according to the aforementioned procedure, your website would be disabled.

In case you need assistance with these settings, please contact us at support@platon.sk.

  • Platon Webhosting
  • Metafox CMS
  • Platon Technologies, s.r.o.