How do you set an A record for any shared host?
You set an A
record for a shared host the same way as you do for any
other host, there is no difference, you use the correct IP-address(es)
and you're done.
But there's several issues there and you're probably asking the wrong question:
Unless the shared hosting platform both explicitly supports adding additional/custom domains to existing hosting plans and you have registered your new domain in your hosting plan, the platform won't actually recognise your additional domain.
Generally shared platforms need to be configured to associate domain names with specific accounts and otherwise won't respond correctly as evidenced by the generic landing page that gets displayed.
I imagine that a shared hosting platform won't provide you with a "correct IP-address" for you to use in your A
record in the first place, as they'll be using a CDN service and/or will want to be able to change IP's at will without breaking your hosting. (Often they'll recommend setting up a CNAME
record instead of an A
record, with the problem that CNAME's can't be used for a bare domain / apex.
This process has worked fine with DigitalOcean Droplets. Why does this work on DigitalOcean and not GitHub/Cloudflare? I was under the assumption that Droplets are shared hosting as well, but maybe not...?
Probably because you never configured a default landing page on your droplets. When you don't explicitly configure a landing page (in web server jargon: "default virtual host") the first/only website becomes the default web site that will always get displayed.
That site will not only show when the correct site name is used, that will also be the site shows when for example the bare IP-address of the server is used, or also when any random, unknown domain name that gets pointed at your server's IP-address is used.
Is there any other way to do a redirect/have a page hosted without having to buy an entire separate droplet?
Use name based virtual hosting on an existing droplet of yours.