Configuring Cloudflare Page Rules

Configuring Cloudflare Page Rules

I moved to Cloudflare sometime ago so that I could take advantage of their tools such as free DNS, SSL, analytics, caching etc. to support my ghost based blog.

I wanted to host my blog on https://blog.many-monkeys.com but I didn't want to host http://www.many-monkeys.com nor http://many-monkeys.com anywhere and wanted to keep my options open i.e. if I wanted to use the domain for more than just a blog.

I still wanted to support https://www... as there are a number of old links out there that point to my old site/blog but I didn't want to pay hosting for a single page that would redirect someone to the blog page. When I read up on this I found some DNS providers have a URL record which is used to configure this sort of behaviour. However I couldn't find out how to configure this sort of record in Cloudflare and so I remained stuck on the single page hosting solution.

The other day I was clicking around the Cloudflare site and I stumbled on the Page Rules and after a bit of trial an error I got it to behave the way I wanted and so I thought I would share.

1. Configure the page rules

Capture-PR

I decided to point both names at the blog with a temporary redirect as that will allow me to change it in the future.

2. Configure the DNS

Capture-DNS

I configured the DNS such that all the domains I wanted to support will route through Cloudflare (the orange cloud image) but instead of being forwarded onto the blog hosting site at ghost.io which would/does fail, the Page Rules above kick-in and do the redirect to blog.many-monkeys.com and all works as I wanted.

By the way you get three free Page Rules and I only needed to use two, I wonder if I'll ever find a need for the third.