How to redirect one Domain to Another with Cloudflare explained.
Up until a few days ago, I did not know you can manage URL and domain redirects and forwarding directly in the Cloudflare dashboard. Other domain name registrars and web hosting companies can do this too (eg. name.com), but I did not know how to manage this in Cloudflare. Maybe you don’t know either and that is why this post exists. Let me show you.
Let’s assume you want to redirect from
Step 1 — Update DNS Settings
First, make sure you manage the domain you want to redirect from on Cloudflare. Next thing you do is adding the following DNS settings:
In this case, we redirect the root (
@) and www of the domain. Point it to a dummy domain, in this case,
18.104.22.168 (got this from here). It’s important that you set the proxy status to
Step 2 — Set up Page Rules
Finally, we add a redirect page rule. When you are not sure which status code fits, read “301 vs. 302 Redirects & SEO: The What, Why & How” on searchenginejournal.com.
In this example, every hit on the old domain (no matter if you open the site with or without
www or with
http) is redirected to the new one.
What does this page rule do now? If the URL matches it will forward the browser to the new target. The following examples will be redirected:
That’s it. You successfully redirected a domain to another with Cloudflare. Congrats!