Ben Borgers

How to redirect one domain to another with Cloudflare

February 12, 2022

You can redirect one domain entirely to another domain using Cloudflare.

First, add an A record in Cloudflare that points the root of the domain (@) to, which is a dummy IP address. We don’t actually care what IP address it’s pointed to, since we’re gonna be redirecting away anyway. The important part is that Proxied is turned on, so that Cloudflare can sit in front of the domain and redirect it before we actually get to the IP address.

In this example, we’re using the domain

Next, go to Rules in the left sidebar and create a new Page Rule for this domain.

For the URL, put in*, where is the domain you want to redirect away from. Then, set it to “Forwarding URL” with a 301 redirect.

In the destination field, put$1, where is the domain you want to redirect to.

An example that redirects and all of its sub-paths to

This will redirect all pages on the domain. For example:


Subscribe to my newsletter!

A weekly round-up of new blog posts and updates to projects I’m working on.