The step-by-step guide to create a domain redirect with Cloudflare
Redirecting a whole domain using Cloudflare can be useful but isn’t documented anywhere, here’s how to do it.
Pre-requisite:
- Be logged into your dashboard.
Select the domain you want to redirect from
Go to page rules
Click “Create page rule”
Enter
your.domain/*
(matches all traffic) for which URLs will have their traffic redirectedClick “Add a Setting”
Select “Forwarding URL”
Select the type of redirect, I recommend 302s since they’re less aggressively cached (so if you ever want to use that domain to do something else other than redirect, you can)
Enter your forwarding URL
Click “Save and Deploy”
You’re done, you’ve just created a redirect from your domain to another one 🙂
Get The Jest Handbook (100 pages)
Take your JavaScript testing to the next level by learning the ins and outs of Jest, the top JavaScript testing library.
orJoin 1000s of developers learning about Enterprise-grade Node.js & JavaScript