Byte Ebi's Logo

Byte Ebi 🍀

A Bit everyday A Byte every week

Setting Up Subdomain with Cloudflare and Customizing GitHub Page URL

After purchasing a domain, you can set up subdomains for different websites. This article demonstrates using Cloudflare + GitHub Page for a static website.

Ray

Previously, I purchased my own domain.Now, I want to use Cloudflare DNS service to set up a subdomain.
And assign it to a specified GitHub Page project as a customized URL.
Once you master this skill, with just one main domain, you can generate different subdomain URLs as needed.
All major DNS service providers offer this feature, and this article uses Cloudflare as an example.

1. Setting Up Subdomain

Go to the Cloudflare management dashboard and click on the DNS tab.
Create a DNS record, select the type as CNAME, and point it to your domain.

cloudflare-dns-cname

2. Setting GitHub Page CNAME

Create a file named CNAME in the root directory of your static website and upload it to GitHub.
The content should be the complete URL of the subdomain, for example, tech.ray247k.com.

github-cname

3. Setting GitHub Page URL

Go to the project Settings > Pages tab and locate the Custom domain section.
Paste the complete URL that was added to Cloudflare DNS and uploaded to the project’s CNAME file.

github-page-custom-domain

By following these steps, you have successfully set up a subdomain with Cloudflare and customized the GitHub Page URL.

Recent Posts

Categories

Tags