Custom Domain¶
Use your own domain name instead of github.io.
Overview¶
Instead of username.github.io/wiki, you can use:
wiki.example.com(subdomain)docs.example.comexample.com(apex domain)
Prerequisites¶
- Deployed wiki on GitHub Pages
- A domain name you own
- Access to domain DNS settings
Setup Steps¶
Step 1: Add CNAME File¶
Create docs/CNAME with your domain:
Or for apex domain:
Commit and push:
Step 2: Update mkdocs.yml¶
Step 3: Configure DNS¶
For Subdomain (wiki.example.com)¶
Add a CNAME record:
| Type | Name | Value |
|---|---|---|
| CNAME | wiki | username.github.io |
For Apex Domain (example.com)¶
Add A records pointing to GitHub's IPs:
| Type | Name | Value |
|---|---|---|
| A | @ | 185.199.108.153 |
| A | @ | 185.199.109.153 |
| A | @ | 185.199.110.153 |
| A | @ | 185.199.111.153 |
Add AAAA records for IPv6:
| Type | Name | Value |
|---|---|---|
| AAAA | @ | 2606:50c0:8000::153 |
| AAAA | @ | 2606:50c0:8001::153 |
| AAAA | @ | 2606:50c0:8002::153 |
| AAAA | @ | 2606:50c0:8003::153 |
Step 4: Enable HTTPS¶
- Go to repo Settings → Pages
- Enter your custom domain
- Click Save
- Wait for DNS check (can take up to 24 hours)
- Check Enforce HTTPS once available
DNS Provider Examples¶
Cloudflare¶
- Go to DNS tab
- Click Add record
- Type:
CNAME - Name:
wiki(or@for apex) - Target:
username.github.io - Proxy status: Can be proxied (orange cloud) or DNS only (gray cloud)
- Click Save
Cloudflare Benefits
- Free SSL certificate
- CDN acceleration
- DDoS protection
- Analytics
Namecheap¶
- Go to Advanced DNS tab
- Click Add New Record
- Type:
CNAME Record - Host:
wiki - Value:
username.github.io - TTL: Automatic
- Click Save
Google Domains¶
- Go to DNS section
- Scroll to Custom resource records
- Name:
wiki - Type:
CNAME - Data:
username.github.io.(note the trailing dot) - Click Add
GoDaddy¶
- Go to DNS Management
- Click Add under Records
- Type:
CNAME - Name:
wiki - Value:
username.github.io - TTL: 1 Hour
- Click Save
Verification¶
Check DNS Propagation¶
Or use online tools:
Test Your Site¶
Should return 200 OK once configured.
Troubleshooting¶
DNS Not Propagating¶
DNS changes can take time:
- Minimum: 5 minutes
- Typical: 1-6 hours
- Maximum: 48 hours
Speed it up:
- Use low TTL values (300 seconds)
- Clear your local DNS cache:
# macOS
sudo dscacheutil -flushcache
# Linux
sudo systemd-resolve --flush-caches
# Windows
ipconfig /flushdns
Certificate Errors¶
If you see SSL warnings:
- Wait for DNS to fully propagate
- GitHub needs to verify domain ownership
- Can take up to 24 hours for certificate issuance
- Check Settings → Pages for status
"Domain already taken"¶
Error in GitHub Pages settings:
Cause: Domain is used by another GitHub repository.
Solution:
- Remove domain from other repository
- Or use a different subdomain
Redirect Loop¶
Cause: Cloudflare proxy with HTTPS redirect
Solution:
- In Cloudflare: SSL/TLS → Overview
- Set SSL mode to Full (not Flexible)
WWW vs Non-WWW¶
To redirect www.example.com to example.com:
- Add CNAME in DNS:
| Type | Name | Value |
|---|---|---|
| CNAME | www | example.com |
- Or use your DNS provider's redirect feature
Best Practices¶
Use HTTPS¶
Always enforce HTTPS:
- ✅ Secure
- ✅ Better SEO
- ✅ Required for modern features
- ✅ Free with GitHub Pages
Choose the Right Domain Type¶
Subdomain (wiki.example.com):
- ✅ Easier to set up
- ✅ Works immediately
- ✅ Can use main site for something else
Apex domain (example.com):
- ✅ Shorter URL
- ✅ Professional appearance
- ⚠️ Requires A records (more complex)
Monitor Your Domain¶
- Set up monitoring (e.g., UptimeRobot)
- Check certificate expiration
- Renew domain name annually
Multiple Domains¶
To serve your wiki from multiple domains:
- Choose one primary domain for
CNAME - Set up redirects at DNS level for others
- Or use Cloudflare Page Rules
Costs¶
- Domain registration: $10-15/year
- GitHub Pages: Free
- SSL Certificate: Free (automatic)
- CDN (optional): Free with Cloudflare
Email Setup¶
Using apex domain for wiki? Set up email separately:
Option 1: Use subdomain for email
- Site: example.com
- Email: mail.example.com
Option 2: Use MX records - Add MX records for email provider - These work alongside A records for web
Testing Checklist¶
Before going live:
- CNAME file committed and pushed
- DNS records configured correctly
- DNS propagation complete (check multiple locations)
- Site loads at custom domain
- HTTPS enabled and working
- Certificate valid (no warnings)
- All internal links work
- Images and assets load correctly
- Search functionality works
- Mobile view looks good
Next Steps¶
- Alternatives - Other hosting options
- Configuration - Optimize your site
- GitHub Pages - Back to main deployment guide
Resources¶
Your wiki, your domain! 🌐