Root Domain Setup Using Cloudflare

Note: For the purposes of this tutorial, we’ll assume your Ghost(Pro) blog lives at the ghost.io subdomain yourblog.ghost.io, and that you have the domain name yourdomain.com which you would like to use instead.

Cloudflare is a DNS management service and content delivery network (CDN). It provides a great deal of tools for managing your DNS and super charging your site. Ghost is partnered with Cloudflare, and all Ghost(Pro) blogs automatically get the benefits from Cloudflare’s CDN. If you would like to configure your blog to use a root domain as the custom domain, we recommend using Cloudflare.

Create an account with Cloudflare

To get started using Cloudflare, the first thing you’ll need to do is create an account on Cloudflare.

Add your website

Once you have signed up, you’ll be given the opportunity to add a domain / website. Enter your domain name, choose “Add website” and Cloudflare will begin scanning your DNS settings.

Update your name servers

Next you’ll need to update the nameservers for your domain. To do this, you’ll need to go to your domain’s DNS provider and change the nameservers to match the nameservers that Cloudflare provides you. When finished, click on the green button to continue.

When you’ve finished updating your domain’s nameserver, and the setup has completed – you should see a list of all the current records tied to your domain. At this point you can add in any missing records (or remove any records), then hit “Continue.”

Next, Cloudflare will ask you to select a plan. Unless you need any of Cloudflare’s other features, you may continue with the “Free” plan.

Once you’ve established your plan, you will want to setup your DNS records, so that your domain can point to your Ghost(Pro) blog.

Select, “DNS” from the menu options at the top of the page.

Using the root level domain as your main domain, while pointing the www version to your Ghost blog

In order to use the root level domain as your main domain, but also point the www version of the domain at your Ghost blog, you need to add a CNAME for your root domain which points to yourdomain.ghost.io.

Create a second CNAME for the www version

Next, create a second CNAME from www.yourdomain.com to yourdomain.com. Your Cloudflare control panel should then look something like this:

Create a page rule

To access your page rules, click on “Page Rules” from the menu options at the top of the page.

On the Page Rules screen, you need to add a new page rule which creates a permanent 301 forward from http://www.yourdomain.com/* to http://yourdomain.com/$1

In the first box after “Add new rule” put http://www.yourdomain.com/* as your URL pattern, then switch Forwarding to ‘On’. You will then be able to enter http://yourdomain.com/$1 as your destination URL, and choose ‘Permanent – 301’ as the forwarding type.

Your rule should end up looking similar to this:

When you’ve finished, click the “Add rule” button to save your page rule. Once saved, you should be able to access your domain by both yourdomain.com and www.yourdomain.com

My redirect is not working
Often times this happens when traffic is not routed through Cloudflare. Be sure that the Cloudflare cloud symbol is enabled (orange) on your CNAME record.

My domain still isn’t working
If you’re still having trouble setting up your custom domain on your Ghost(Pro) blog, please see our guide here for details, OR, feel free to reach out to [email protected] for help.