isotropic-2022
Share
Blog
Search
Menu

How To Redirect A Domain On Cloudflare

By James LePage
 on January 6, 2021
Last modified on January 7th, 2022

How To Redirect A Domain On Cloudflare

By James LePage
 on January 6, 2021
Last modified on January 7th, 2022

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:

Subscribe & Share
If you liked this content, subscribe for our monthly roundup of WordPress news, website inspiration, exclusive deals and interesting articles.
Unsubscribe at any time. We do not spam and will never sell or share your email.
Subscribe
Notify of
guest
7 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Ali
Ali
6 months ago

129.0.2.1 works! thx.

TRENDYOL
TRENDYOL
5 months ago

Thx

xcyenze
xcyenze
2 months ago

is 129 or 192 ???

aalaap
aalaap
2 months ago
Reply to  xcyenze

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.

Cloud
Cloud
1 month ago

this works for me. Thanks a lot.

Laxmikant Bhumkar
Laxmikant Bhumkar
27 days ago

Post includes 129.0.2.1 instead of 192.0.2.1

Please correct it.

Scott N
Scott N
20 days ago

According to RFC 5737:

The blocks 192.0.2.0/24 (TEST-NET-1), 198.51.100.0/24 (TEST-NET-2), and 203.0.113.0/24 (TEST-NET-3) are provided for use in documentation.

Therefore the screenshot is right, and the text description is wrong. Use 192.0.2.1.

Article By
James LePage
Contributors/Editors
notloggedin
James LePage is the founder of Isotropic Design, a digital agency that builds WordPress websites. I read, write and design constantly!
We're looking for new authors. Explore Isotropic Jobs.
Close
🇺🇸 English
Save posts, access exclusive content, join members-only communities and more.
Dark Mode Toggle
Love web dev? Join the Isotropic weekly newsletter.
cross
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram
0

Your Cart is Empty