I apologize if the title is a little confusing, since I don’t know the exact terminology for redirects.
I own a domain, say, example.com
that I manage under Cloudflare. I also have a Github repo, say, foo
that is hosted as https://hobbes3.github.io/foo/index.html. However, my website code only works if my index.html
is at the root level like https://example.com/index.html. Because the extra foo/
path in the default github.io breaks my code due to JavaScript and image referencing off the root path.
So, is there anyway I can have my repo as subdomains and redirect https://foo.example.com/ to https://hobbes3.github.io/foo/ while preserving my domain name (meaning I don’t want the URL to actually change to the github.io path)?
Cloudflare redirects: https://developers.cloudflare.com/rules/url-forwarding/
Then later I can do something like https://bar.example.com/ for my bar
repo as well.
Or do I have to rewrite all my website code to hardcode the Github repo name, foo
and bar
? Or I have to host my own server like Apache or Nginx to perform this kind of redirect?