I own a
.me domain (bought with GoDaddy), where I have my web hosted using Github pages. Now, I would like to create a sub-domain or sub-page (such that
example.me/subdomain) and fill it with an external template that I want to buy using a web-provided such as Squarespace. Is is possible to do that?
I own a
You can do this for a subdomain (ie subdomain.example.com) - as DNS is designed (among other things) to direct different different subdomains to appropriate ip addresses.
It is only indirectly possible to have 2 servers hosting content to a site (ie in the case example.com/resource1 on a different server to example.com/ or example.com/resource2) and a lot harder to implement. In order to do this you need to add some kind of reverse proxy or load balancer which accepts the requests and then gets them to the appropriate server. I believe Cloudflare may be able to do this and I know that Apache can be confugured to do this using mod-proxy with proxypass rules - but setting this up requires access to the server configuration and some specialist knowledge). There are analogous mechanisms for NGINX as well as standalone proxies.
It should be relatively straight forward to configure a subdomain to point to another service like Squarespace, however, to point a subdirectory to an external host requires very different technologies and is unlikely to be possible with using only Github pages and Squarespace.
To forward the subdomain you would configure either an
A record in the DNS to point to an IP address at Squarespace (or a
CNAME record to point the subdomain to an already configured domain at Squarespace) and configure this hostname/subdomain at Squarespace, so that it knows to accept requests to this hostname.
However, to forward a subdirectory requires that you configure a reverse proxy at your source host (Github pages), which AFAIK Github pages does not support*1. This may also be against Squarespace's interests/T&Cs and they could potentially (attempt to) block the request.
*1 Although as noted by @davidgo in comments, you could employ an additional service that sits in front of Github pages that implements the reverse proxy.
Yes it is possible to create https://here.example.com hosted on a different server, create a subdomain name and set the DNS A record to your desired IP address.
Sub path is harder to implement and generally your host will need to setup and will most likely change an extra monthly cost to do so. Not impossible just more difficult.