Adding unlimited subdomains via mod_rewrite
Important! domain.ru must be replaced everywhere with your domain for which subdomains are being created.
3. Click on the settings link opposite the subdomain; the domain settings page opens.
-Aliases field: add the *.domain.ru entry
-Below are two points to enable Apache instead of Nginx for... - check the boxes.
- Click the Change settings button
4. Return to the Domains section and click the DNS link opposite the main domain domain.ru.
5. On the page that opens, there's an empty field below the settings table. Add * , A , and IP address to this field. The IP address can be found in the same place, in other DNS settings fields, or at the very bottom of the page, using the default IP address (see image).
6. Click Edit Table
7. Go to the WebFTP section in the hosting panel. There, navigate to the domain folder; in our case, it's called sub.domain.ru.
8. Create a file in the folder called .htaccess , the period at the beginning is required.
9. Open the file and add the code:
RewriteEngine On
RewriteCond $1 !^subs/
RewriteCond %{HTTP_HOST} !^(www.)?domain\.ru$ [NC]
RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+)\.domain\.ru$ [NC]
RewriteRule ^(.*)$ subs/%2/$1 [L]
! Don't forget to replace domain\.ru here with your domain name.
10. In the same folder (domain folder) create a folder named subs .
11. Go to the subs folder, where we'll create folders for all the subdomains we need. For example, the path /home/HOSTING_LOGIN/sub.domain.ru/subs/name will open in the browser as http://name.domain.ru.
This method of creating subdomains is convenient because you don't need to add the domain in the Domains section of the hosting panel. Simply add the folder using an FTP client or in the WebFTP section, and the subdomain will be immediately available.