: Is it possible to have a CNAME DNS record point to a URL with a path? I've registered several domains for my nieces and nephews, the idea being to create small static webpages for them, so
I've registered several domains for my nieces and nephews, the idea being to create small static webpages for them, so they can say 'look at my website!'.
In terms of hosting it, I'm using expressjs on Heroku, to serve up static pages.
What I'm wanting to do is have:
suzy-derkins.space --> my-herokuapp.herokuapp.com/static/suzy calvin-is-trouble.space --> my-herokuapp.herokuapp.com/static/calvin
Now I can user a CNAME record to point each of my domains at my-herokuapp.herokuapp.com, but a CNAME record won't allow a full URL.
I could add an unmasked redirect, so that
suzy-derkins.space redirects to suzy-derkins.space/static/suzy, but that's ugly.
I don't want to use a masked URL redirect - as that causes problems on mobile, and also the user presses any links, the new page remains masked.
I'd also like to retain the ability to add additional pages, for example:
my-herokuapp.herokuapp.com/static/suzy/my-favourite-things be represented by suzy-derkins.space/my-favourite-things.
What kind of records do I use to do this?
More posts by @Smith883
1 Comments
Sorted by latest first Latest Oldest Best
DNS records alone cannot do what you want. DNS records only point host names to IP addresses (or in the case of CNAMEs to other host names).
You have to configure your server to handle it correctly.
One way is to issue redirects. I presume that you think that is ugly because the URL changes.
Another way is to set up "virtual hosts" with different content for each of these host names. I've never used Heroku before, but it appears that you can add multiple custom domains to it: devcenter.heroku.com/articles/custom-domains
In a single application with multiple host names pointed at it you can usually discern the host name and program your application to act accordingly. I haven't been able to figure out how to do so in Heroku, but it should be part of the HTTP Request. It is sent as the Host: HTTP header.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.