In this article, we're going to show you how to redirect a domain on Cloudflare. This is especially useful if you have moved your website, still have the old domain, and want to point it to the new location without having to use the HTAccess method or a CNAME record.
This question could also look like this: "How do I use Cloudflare DNS records to redirect my domain?"
The first thing to note is that you do not use DNS to redirect a domain. DNS is not created for that. Instead, you will use Cloudflare page rules. Even if you're on a Cloudflare free plan, and you're looking to redirect your domain, you have access to three free page rules. For a simple redirect, you only need one period let's talk about how to redirect your domain on Cloudflare, no matter what your plan tier is.
The first step is navigating to the page rules tab of your Cloudflare dashboard. This is not under DNS, instead it is under its own section. Once you're on the page rules tab, go ahead and click on create a new page rule button.
First, type in your root name, with a slash after it, and after an *. What this do is create a catchall redirection rule, so if the domain matches anything under that route, it will redirect to the new location.
Under then these settings are, select the forwarding URL option. Finally, enter the URL that you would like your Cloudflare domain to redirect to within the respective input field.
Finally, apply the rule, and your old domain will now forward to the new one. Any URL underneath it will forward to the applied domain as well.
The one other thing I would do is delete all the DNS records except for a cname WWW pointing to the original domain, and setting the original domain to have an A record pointing to 129.0.2.1. That IP is just a basic placeholder that has been used since the Internet was invented.
If your Cloudflare domain redirection is not working, ensure that it is being proxied through the service. That means that you need to have the a record with the orange cloud showing. If the cloud is Gray then it is not proxy through the service and the page rule will not apply to it.
More info:
129.0.2.1 works! thx.
Thx
is 129 or 192 ???
I've been wondering about the same. 129.0.2.1 appears to be owned by "AS30992 MTN Network Solutions (Cameroon)" and as such doesn't seem to be related to local 127.0.01 type addresses. 192.0.2.1 also works, but that also points to some other org.
That leads me to believe that any A entry will work, as the page rules get processed before this is hit, but I'd still be wary of adding A entries to random addresses. Just grab the IP address of your web host and use that. I'm using Vercel, so I used 76.76.21.21 and it's fine.
this works for me. Thanks a lot.
Post includes 129.0.2.1 instead of 192.0.2.1
Please correct it.
According to RFC 5737:
Therefore the screenshot is right, and the text description is wrong. Use 192.0.2.1.
This is very helpful. I didn't know how to configure the DNS if just pointing my domain at an "unhosted" web site. Thanks!