Applicable to:
- Plesk for Linux
Question
How to add an alias for subdomain in Plesk for Linux?
For example, the subdomain name is one.example.com
and the alias name should be alias.one.example.com
.
Answer
This functionality is not implemented in Plesk yet. Vote for this feature on the Plesk User Voice portal.
Top-ranked suggestions are going to be implemented in the next Plesk versions.
Consider applying any of the below workarounds:
-
Recreate the subdomain as a "domain" by clicking on Domains > Add domain and naming it one.example.com
-
Click on Domains > Add Domain Alias and select the domain one.example.com:
Note: If you are a domain owner and Apache/nginx additional directives are hidden, please contact the server administrator or provider for assistance.
-
Add additional directives for the subdomain in Domains > sub.example.com > Apache & nginx Settings:
-
for Additional directives for HTTP and Additional directives for HTTPS:
CONFIG_TEXT: ServerAlias alias.sub.example.com
-
for Additional nginx directives:
CONFIG_TEXT: server_name alias.sub.example.com;
-
Comments
14 comments
I solved this problem through "Apache & nginx Settings" of my subdomain
Just make sure your alias subdomain resolves correctly to the same IP as your base subdomain you want to stick your alias to.
Hello @Sage, thank you for sharing an alternative way to achieve this goal.
Have you tried the steps from the article? Why was this way not suitable for you?
Thank you in advance.
Hello, @Ivan,
Article offers redirect, redirect is not alias, it's just a redirect which sends browser to another location.
Alias is fully-functional another name that points to same virtual host of webserver which is visible under it's own name, not under base subdomain name (they could belong to different domains at all).
In my case, IP from DNS record became inaccessible (it pointed at old load balancer which IP became unavailable) and I created temporary address that users could use until their cached DNS completely change to point to new address. But not to bother with different DocumentRoot trees i just made it alias of another (temporary inaccessible for some users) subdomain. Yes, probably it's square-wheeled bicycle solution, but at least it works.
Hi @Sage!
The article has been updated according to your recommendations.
Thanks for taking part in improving our knowledge base!
Hello,
This solution is really great. But how do I have to make Let's Encrypt also register the alias in the certificate?
Thank you in advance.
@Andrew, this article should answer your question:
https://support.plesk.com/hc/en-us/articles/213372009-How-to-install-a-certificate-for-domain-alias
Can anybody pleaaaaase, explain this workaround better ...?
@Mohamed Kheddime
I have added a screenshot of Apache additional directives screen. Hope this helps to apply the workaround.
If you are a domain owner and Apache/nginx additional directives are hidden, it is needed to contact your service provider for assistance.
Reply me if something else should be added to describe the workaround in a best way.
The solution only works partially:
If the web space is to redirect from HTTP to HTTPS (HTTP-301), the Apache rules for HTTP (port 80) are not included in the configuration using Include. This meanst it does not redirect a HTPP-Request to HTTPS. It shows the HTTP default page.
Let's Encrypt does not work either, because Plesk does not know the alias subdomains in the interface.
Very unsatisfactory that such a simple function is missing.
Translated with www.DeepL.com/Translator
@Ivan: Perhaps I miss something, but your tip does not work for me.
Hello @Jens Feierabend!
Thank you for reporting this! The article was updated accordingly.
The fact that additional HTTP directives are not used when the option Permanent SEO-safe 301 redirect from HTTP to HTTPS is enabled in Domains > sub.example.com > Hosting Settings is a known issue caused by the Plesk bug PPPM-9230.
See the article https://support.plesk.com/hc/en-us/articles/360008854853 for more information on the issue.
OMG how this is not a part of Plesk.
My voiice on Plesk User Voice of course has been added but how this is not a part of normal funcionality I really don't know.
Hello @Grzegorz Wołoszyn,
Thank you for the feedback and for voting for this functionality.
Plesk Development team was concentrated on features with higher priority. If this functionality will be popular, it will definitely be implemented.
Stay tuned for this article all the updates about it will be added here.
Work around 1 doesn't give me access to the files in the original main accounts file system, so functions like file_exists() can't be used.
Work around 2 seems to be giving me issues with issuing an SSL to suit and I'm not convinced that it's actually working either.
Can you please work this into the main system with your next software update? Their needs to be a more graceful way to handle this. Thank you.
HI @Anthony Parker, could you please describe what error you get for workaround 2? It would be better if you open a support ticket with us in order to speed up the process.
Please sign in to leave a comment.