How to add an alias to subdomain?

Follow

Comments

6 comments

  • Avatar
    Sage Pointer (Edited )

    I solved this problem through "Apache & nginx Settings" of my subdomain

    Additional directives for HTTP:
    ServerAlias my.alias.subdomain.tld
    Additional directives for HTTPS:
    ServerAlias my.alias.subdomain.tld
    Additional nginx directives:
    server_name my.alias.subdomain.tld;

    Just make sure your alias subdomain resolves correctly to the same IP as your base subdomain you want to stick your alias to.

  • Avatar
    Ivan Postnikov (Edited )

    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.

  • Avatar
    Sage Pointer

    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.

  • Avatar
    Anzhelika Khapaknysh

    Hi @Sage!

    The article has been updated according to your recommendations.
    Thanks for taking part in improving our knowledge base!

  • Avatar
    Andrew Sassoye

    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.

Please sign in to leave a comment.

Have more questions? Submit a request