How to manage custom domains

This guide describes how to host your documentation using your own domain name, such as docs.example.com.

Adding a custom domain

To setup your custom domain, follow these steps:

  1. Go the Admin tab of your project.

  2. Click on Domains.

  3. Enter the domain where you want to serve the documentation from (e.g. docs.example.com).

  4. Mark the Canonical option if you want use this domain as your canonical domain.

  5. Click on Add.

  6. At the top of the next page you’ll find the value of the DNS record that you need to point your domain to. For Read the Docs Community this is readthedocs.io, and for Business hosting the record is in the form of <hash>.domains.readthedocs.com.

Once you have completed these steps and your new DNS entry has propagated (usually takes a few minutes), you need to build your project’s published branches again so the Canonical URL is correct.

Note

For a subdomain like docs.example.com add a CNAME record, and for a root domain like example.com use an ANAME or ALIAS record.

We provide a validated SSL certificate for the domain, managed by Cloudflare. The SSL certificate issuance should happen within a few minutes, but might take up to one hour. See SSL certificate issue delays for more troubleshooting options.

To see if your DNS change has propagated, you can use a tool like dig to inspect your domain from your command line. As an example, our blog’s DNS record looks like this:

dig +short CNAME blog.readthedocs.com
 readthedocs.io.

Warning

We don’t support pointing subdomains or root domains to a project using A records. DNS A records require a static IP address and our IPs may change without notice.

Removing a custom domain

To remove a custom domain:

  1. Go the Admin tab of your project.

  2. Click on Domains.

  3. Click the Remove button next to the domain.

  4. Click Confirm on the confirmation page.

Warning

Once a domain is removed, your previous documentation domain is no longer served by Read the Docs, and any request for it will return a 404 Not Found!

Strict Transport Security (HSTS) and other custom headers

By default, we do not return a Strict Transport Security header (HSTS) for user custom domains. This is a conscious decision as it can be misconfigured in a not easily reversible way. For both Read the Docs Community and Read the Docs for Business, HSTS and other custom headers can be set upon request.

We always return the HSTS header with a max-age of at least one year for our own domains including *.readthedocs.io, *.readthedocs-hosted.com, readthedocs.org and readthedocs.com.

Note

Please contact Site support if you want to add a custom header to your domain.

Multiple documentation sites as sub-folders of a domain

You may host multiple documentation repositories as sub-folders of a single domain. For example, docs.example.org/projects/repo1 and docs.example.org/projects/repo2. This is a way to boost the SEO of your website.

See also

Subprojects

Further information about hosting multiple documentation repositories, using the subproject feature.

Troubleshooting

SSL certificate issue delays

The status of your domain validation and certificate can always be seen on the details page for your domain under Admin > Domains > YOURDOMAIN.TLD (details).

Domains are usually validated and a certificate issued within minutes. However, if you setup the domain in Read the Docs without provisioning the necessary DNS changes and then update DNS hours or days later, this can cause a delay in validating because there is an exponential back-off in validation.

Tip

Loading the domain details in the Read the Docs dashboard and saving the domain again will force a revalidation.

The validation process period has ended

After you add a new custom domain, you have 30 days to complete the configuration. Once that period has ended, we will stop trying to validate your domain. If you still want to complete the configuration, go to your domain and click on Save to restart the process.

Migrating from GitBook

If your custom domain was previously used in GitBook, contact GitBook support (via live chat in their website) to remove the domain name from their DNS Zone in order for your domain name to work with Read the Docs, otherwise it will always redirect to GitBook.