# Using Cloudflare Page Rules to Point a Root Domain to a GitBook Site

GitBook only allows the usage of subdomains when pointing to a GitBook site. In the free version of GitBook, this can't be changed but an HTTP redirect via a Cloudflare page rule is a cheap, fast, and easy way to send users from a root domain to a subdomain where a GitBook site is hosted.

**Example:** blakejarvis.com -> [www.blakejarvis.com](http://www.blakejarvis.com) (GitBook site)

### Why Not Double CNAME?

Using a CNAME pointer to redirect blakejarvis.com to [www.blakejarvis.com](http://www.blakejarvis.com) via DNS would make the most sense, but Cloudflare doesn't allow double CNAMEs within the Cloudflare network. Instead, a Cloudflare page rule will serve an HTTP 301 redirect to send all users to [www.blakejarvis.com](http://www.blakejarvis.com) where the GitBook Site is hosted.

### DNS Records

Add a CNAME DNS entry in the domain's DNS zone to point [www.blakejarvis.com](http://www.blakejarvis.com) to hosting.gitbook.io. This is required by GitBook.

Add a 'dummy' DNS a record for the root site blakejarvis.com to point anywhere. In this case, Cloudflare's 1.1.1.1 resolver is used.

![](/files/-MXtLrNBY9W-4_to0EX6)

### Cloudflare Page Rules

Create a page rule to redirect all traffic to blakejarvis.com to [www.blakejarvis.com](http://www.blakejarvis.com) via a 301 HTTP redirect. Any 301 redirect implementation will work (e.g. PHP on Apache), but serving this rule at the Cloudflare edge will be the fastest.

![](/files/-MXtLnLfl3y5Fkl-0T9g)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.blakejarvis.com/miscellaneous-articles/using-cloudflare-page-rules-to-point-a-root-domain-to-a-gitbook-site.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
