GitHub Pages Project Site URL Rules | Generated by AI

Home PDF

With GitHub Pages, you can create Project Sites under your personal account in addition to your User Site (username.github.io). However, the format of the URL for Project Sites is limited to specific patterns, and not all subdomain or subpath configurations are natively supported. Let’s address your question about whether you can use username.github.io/project1 or project1.username.github.io for Project Sites.

Key Points

Can You Use username.github.io/project1?

Yes, you can use username.github.io/project1 for a Project Site. This is the standard way GitHub Pages handles Project Sites:

Can You Use project1.username.github.io?

No, GitHub Pages does not support subdomains like project1.username.github.io natively under the github.io domain. The github.io domain only allows:

To achieve a URL like project1.username.github.io, you would need:

  1. A Custom Domain: Purchase a domain (e.g., example.com) from a registrar like Namecheap or GoDaddy.
  2. DNS Configuration: Set up a CNAME record to point a subdomain (e.g., project1.example.com) to your GitHub Pages site (e.g., username.github.io or username.github.io/project1).
  3. GitHub Pages Settings:
    • In the repository’s Pages settings, configure the custom domain (e.g., project1.example.com).
    • Optionally, enable “Enforce HTTPS” for security.
  4. Outcome: You can map project1.example.com to the content of the project1 repository, but not project1.username.github.io, as GitHub controls the github.io domain and doesn’t allow custom subdomains under it.

Example Setup for username.github.io/project1

  1. Create a repository named project1 under your account (username/project1).
  2. Add content (e.g., index.html):
    git clone https://github.com/username/project1
    cd project1
    echo "Hello from Project 1" > index.html
    git add --all
    git commit -m "Initial commit"
    git push origin main
    
  3. Enable GitHub Pages:
    • Go to username/project1SettingsPages.
    • Set the source to main (or another branch) and save.
  4. Visit https://username.github.io/project1 to see the site live (may take a few minutes to propagate).

Example for Custom Subdomain with a Custom Domain

If you want project1.example.com:

  1. Own a domain (e.g., example.com).
  2. In your DNS provider’s settings, add a CNAME record:
    • Name: project1
    • Value: username.github.io
  3. In the project1 repository’s Pages settings, set the custom domain to project1.example.com.
  4. Push content to the project1 repository, and it will be served at project1.example.com.

Limitations

Summary

If you need help setting up a specific Project Site, configuring a custom domain, or managing multiple sites, let me know!


Back 2025.06.29 Donate