You can set up a custom subdomain, such as blog.example.com, by creating a CNAME record through your DNS provider.

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.

Warning: We highly recommend adding your custom domain to your GitHub Pages site's repository before configuring your domain name with your DNS provider. For more information, see "Adding or removing a custom domain for your GitHub Pages site."

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

Configuring a CNAME record with your DNS provider

  1. Confirm that you have added a custom domain to your GitHub Pages site.

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

  3. Follow your DNS provider's instructions to create a CNAME record that points from your default pages domain, such as YOUR-GITHUB-USERNAME.github.io to your subdomain. Your 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. *.example.com) 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.

  4. 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 docs.example.com +nostats +nocomments +nocmd
    ;docs.example.com.                     IN      A
    docs.example.com.              3592    IN      CNAME   YOUR-USERNAME.github.io.
    YOUR-USERNAME.github.io.           43192   IN      CNAME  < GITHUB-PAGES-SERVER >.
      < GITHUB-PAGES-SERVER >.      22      IN      A       199.27.XX.XXX
    

Further reading