GitHub Pages offer a free hosting service for static sites.
The setup is simple and concisely described on pages.github.com.
To enable this feature all you have to do is to create a public repo named ${your-github-username}
, e.g. “metters”.
I am hosting my site somewhere else, so I would like to forward from metters.github.io to there.
All I had to do is adding a file named CNAME
containing the url to forward to, e.g. blog.metters.dev
.
Requests to “metters.github.io” are now being forwarded:
curl metters.github.io
<html><head><title>301 Moved Permanently</title></head><body><center><h1>301 Moved Permanently</h1></center><hr><center>nginx</center></body></html>
Let’s see where the redirect leads to (not without filtering out some noise)
# Use "location" to follow redirects; "sed" to retrieve the title of the body of the response# Get anything between the "<title>" tags and print itcurl --silent --location "metters.github.io" | sed -n 's/.*<title>\(.*\)<\/title>.*/\1/p'
<html>Home • blog.metters.devLogo</html>
Resources
- Step by step manual, how to set up your own GitHub Page: https://pages.github.com/
- My own GitHub Page using a CNAME file to forward to my own site
- I had to look up the flags for cURL: