How to Setup 301 Redirect Using Cloudflare?

Recently made some re-branding with one of our old blog, very popular and has been online for 6+ years, I made the redirect using Namecheap DNS server (those using Namecheap should be familiar with this) but it did not work for me and majority of the world, then I moved the DNS to DNSMADEEASY infrastructure but then a new issue arise which is SSL error, which is not a good sign as it could damaged the reputation of the domain.

- Advertisement -

So during my research I found some tutorial on how to use Cloudflare to 301 redirect and forward the old domain to the new one with no SSL issues, but the tutorial did not work so with the help of the Cloudflare community I was able to get it working.

How to redirect domain using Cloudflare?

So, let?s get started with the steps on how to use Cloudflare network for domain forwarding?

Step 1

First you will need to add your domain that you want to redirect to Cloudflare. Simply signup for a free account, then add your domain and proceed to the next step.

Step 2

Here you will select the FREE plan and then continue to the next step.

Step 3

By default the scan will show you the records of your current domain. You can simply delete everything and simply leave an A name record for both the www version and your primary domain. Replace your IP with this one (This is a dummy IP leads nowhere, so don’t worry). Below is a screenshot of our my settings looks like.

Step 4

Next step is to update the nameserver for the domain you wish to redirect, for me its or I have made the changes in my Namecheap account.

Step 5

Under the Crypto menu, select ?Flexible? SSL. You will need this to ensure that redirects over HTTPS also work.

301 Redirect Cloudflare

This enables a universal SSL certificate on both * and This uses SNI and works on all major browsers… (looking at you explorer ? ).

Step 6

Under the Page Rules menu click on ?Create Page Rule.?

- Advertisement -
301 Redirect Cloudflare

Step 7

Here is where the magic happens, so make the following changes..

You will then want to enter the following pattern:


Select ?Forwarding URL? and ?301 ? Permanent Redirect? for the settings, and input the following rule:$2

The /$2 enables the wildcard part to function. Then click on ?Save and Deploy.?  Below is a screenshot of what was done, just follow the steps outlined.

301 Redirect Cloudflare

The single rule above makes the following work:

  • 301 redirects to
  • 301 redirects to
  •* 301 redirects to*
  •* 301 redirects to*

To see if its working you can use redirect tracker or

Read more about Cloudflare page rules. And that is it! You can now ditch the hosting plan on your old domain and your wildcard 301 redirects will now be in place forever, pointing to your new domain. If you have any issues concerning this tutorial simple comment below or post in the cloudflare forum.

Evan Spiegel Biography and Net Worth

Since he does not have an outgoing personality, you might not know so much...

FaceApp: Everything You Need to Know

If you have been on social media lately, you might have come across older...

8 Ways to Free Up Disk Space in Windows 10

There?s a new trend where Windows user now install Windows 10 on a solid-state...

- Advertisement -


Please enter your comment!
Please enter your name here