Redirecting One Domain to Another Domain on Cloudflare

2021-02-13

This tutorial covers redirecting one domain to another. For this, we will be redirecting domainA.com to domainB.com.

The following settings need to be configured under the domain you are redirecting from, in this example, this is domainA.com

Step 1, The DNS Record:
The first thing you will need is a DNS record for @, www and any other subdomains you want to redirect, set to cloudflare. This can point to any IP address as the redirection page rule will execute first. I would recommend pointing them to 192.0.2.1 , a dummy IP.

Step 2, The Page Rule:
The second step is the page rule that will perform the redirect. You should add one like this:

This page rule will redirect as per the following examples:

domainA.com > https://domainB.com

www.domainA.com > https://domainB.com

domainA.com/page > https://domainB.com

www.domainA.com/page > https://domainB.com

Should the domain you are redirecting to be served on www, you can add www to the URL at the bottom of the page rule.

servercloudflare

Rojen Zaman

Anarchist | GnuPG: 0x9089BB25

Nextcloud on Android

mkp224o binary for RHEL x86-64