Setting up a www subdomain

To set up a www subdomain, such as you must configure a CNAME record with your DNS provider.

GitHub Pages is available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see "GitHub's products."

Tip: If you have trouble configuring your CNAME record, then contact your DNS provider for help. They can help confirm that you have configured your custom domain correctly with their services.

For more information on www subdomains, see "About supported custom domains."

Configuring a CNAME record with your DNS provider

  1. Contact your DNS provider for detailed instructions on how to set up the subdomain you added to your repository's CNAME file.

  2. Follow your DNS provider's instructions to create a CNAME record that points your subdomain to your default pages domain. For example, if you own the subdomain, you can configure a CNAME record to point to DNS changes can take over a full day to update, and the wait varies among DNS and hosting providers.

    Danger: Do not use wildcard DNS records (e.g. * with GitHub Pages! A wildcard DNS record will allow anyone to host a GitHub Pages site at one of your subdomains.

    Note: Your default GitHub Pages domain is determined by the type of pages site you have. For examples, see this domain chart.

  3. To confirm that your DNS record is set up correctly, use the dig command with your custom domain. Using a custom domain as an example:

    $ dig +nostats +nocomments +nocmd
    > ;                     IN      A
    >              3592    IN      CNAME
    >      43192   IN      CNAME   < GITHUB-PAGES-SERVER >.
    > < GITHUB-PAGES-SERVER >.      22      IN      A       199.27.XX.XXX
  4. Add your custom domain to your GitHub Pages site. If you're updating an existing custom domain, first remove and then re-add your custom domain to your GitHub account to trigger the process of enabling HTTPS. For more information, see "Adding or removing a custom domain for your GitHub Pages site."

Further reading

Ask a human

Can't find what you're looking for?

Contact us