Disclaimer: Written by GPT-4
I want to set cusom domain like mgorbatyuk.dev for my website hosted on guthub pages. How can I do it?
To set a custom domain for your GitHub Pages website, you'll need to follow these steps:
- Purchase a domain: First, you need to purchase your custom domain (mgorbatyuk.dev in your case) from a domain registrar like Google Domains, Namecheap, or GoDaddy. Follow their process to register your domain.
- Update your domain's DNS records: After purchasing the domain, you'll need to update its DNS records. To do this, go to your domain registrar's DNS settings and create two new records:
- A record: Point the A record to the following GitHub Pages IP addresses:
- 185.199.108.153
- 185.199.109.153
- 185.199.110.153
- 185.199.111.153
- CNAME record: Create a CNAME record with the 'www' subdomain, pointing to your GitHub Pages repository's default domain (e.g., 'username.github.io').
- Wait for DNS propagation: DNS changes may take some time to propagate (up to 24-48 hours in some cases). You can use a tool like **https://www.whatsmydns.net/** to check the propagation status.
- Configure your GitHub Pages repository: Go to your GitHub repository that's hosting your website, and click on the 'Settings' tab. Scroll down to the 'GitHub Pages' section.
- Add your custom domain: In the 'Custom domain' field, enter your purchased domain (e.g., 'mgorbatyuk.dev') and click 'Save'. This will create a CNAME file in your repository if it doesn't already exist.
- Enable HTTPS: After the DNS propagation is complete, you should see an option to 'Enforce HTTPS' in the GitHub Pages settings. Enable this to make sure your website is served securely over HTTPS.
That's it! Once these steps are complete, your GitHub Pages website should be accessible via your custom domain. Note that it may take some time for the HTTPS certificate to be issued and the changes to propagate fully.
You said "Create a CNAME record with the 'www' subdomain, pointing to your GitHub Pages repository's default domain (e.g., 'username.github.io')." What www subdomain you mean?
Apologies for the confusion. The 'www' subdomain refers to the most common subdomain used for websites, which stands for 'World Wide Web.' It's often used as a prefix to the main domain name, like www.example.com
.
In this context, I'm suggesting you create a CNAME record for the 'www' subdomain to ensure that your website is accessible with both the root domain (e.g., 'mgorbatyuk.dev') and the 'www' subdomain (e.g., 'www.mgorbatyuk.dev').
To do this, create a CNAME record in your domain registrar's DNS settings with the following details:
- Type: CNAME
- Host/Name: www
- Value/Points to: your GitHub Pages repository's default domain (e.g., 'username.github.io')
By creating this CNAME record, you'll be redirecting all traffic from 'www.mgorbatyuk.dev' to your GitHub Pages repository's default domain (e.g., 'username.github.io'), ensuring that users can access your website using either the root domain or the 'www' subdomain.