Estimates, I need you to tell me how to create the subdomains in the panel (client.example.com).
Is this within the domain already created (example.com) as in other CPs or are they managed as a separate domain?
yes, a subdomain is added as a regular web domain
@jorgepala if you want to have a subdomain pointing to a subfolder below a regular web domain, you could simply add it as alias and use .htaccess to redirect (if using apache2) or add a custom config to your vhost. or you set it up as seperate domain and link the folder
Sorry to open an old thread!
Due to legacy reasons, I also need a subdomain as a folder in the main domain.
Iāve added the subdomain as a domain, and added an A record in the DNS of the main domain, but when I try to change the document path, āError: Error: target dir outside of target domain dirā.
How do I add an alias? Where? in the text box that contains āwwwā ?
For anyone having the same problem:
An alias is where you add the www (edit domain). Donāt forget to renew the Letās Encypt SSL with the new alias. (donāt know where,yet).
To redirect the subdomain to a folder, just add this code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^sub.domain.com
RewriteRule ^(.*)$ /subdomains/sub/$1 [L,NC,QSA]
(taken from https://stackoverflow.com/questions/10642426/htaccess-rewrite-subdomain-to-directory)
Make sure the folder exists
You can create a subdomain and put a custom route when creating it, it is one of the new options in hestia, at least it works for me.
domain.com path ā/home/user/web/domain.com/public_html/ā
subdom.domain.com path ā/home/user/web/domain.com/public_html/subdomā
Also make sure the folder exists:) Hestia doesnāt create the folder for you.
The code @noxtras shared lead to internal server error for my subdomains
Found another one on VestaCP docs
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(?!www\.)([^.]+)\.domain\.com$ [NC]
RewriteCond %{REQUEST_URI}::%1 !^/([^/]+).*?::\1
RewriteRule ^(.*)$ /%1/$1 [L]
This one does the job quite well for me, Guess Iād share.
Hope it helps
hey @jorgepala do you mind to elaborate about this, i donāt understand you.
This is a 3 year old topicā¦