Dynamic Redirect of Old Domain to New Domain in Cloudflare
⚠️ NOTE ⚠️
This was originally written for those wanting to change their domain name in Kajabi. However, this will work for any platform.
Depending on the situation though, some additional Page Rules in Cloudflare may be needed (for example, if you had your checkout pages on a subdomain and your website on your root domain).
Point is: where there’s a will, there’s (usually) a way!
Once you complete the following steps, ALL old URLs from your old domain will automatically redirect to the exact same URLs on the new domain.
Let's dive in!
First and foremost, both of your domains (the old and the new) need to be added to a free Cloudflare account.
This involves changing your nameservers at your domain registrar. If this is beyond the scope of your knowledge or comfort level, feel free to reach out. I can handle this in under an hour in most all cases. ✨
Once both domains are in a free Cloudflare account and the DNS nameservers have been changed to Cloudflare's nameservers, then you can remove the old domain from Kajabi and add the new one (in Kajabi). Use the second option, to add a subdomain. The subdomain will be "www". And follow the rest of the steps in your Cloudflare DNS settings.
Once the new domain is successfully set up and working in Kajabi, then you can follow these instructions inside of your free Cloudflare account...
Steps to Redirect the Old Domain (in Cloudflare) to the New One
1.) Go to "DNS" for the old domain and create a new "A" record. The Name should be "@" and the Content should be "192.0.2.1" (both without quotation marks). If an A record already exists for the root domain, just update the Content to "192.0.2.1". Make sure the orange cloud (Proxy) is turned on.
2.) Still in the old domain's "DNS" area, see if there is already a CNAME of "www". If there is, update the Content value to "@". If not, create a new CNAME for "www" and set the Content to "@".
3.) In the Cloudflare menu on the left, go to "Rules > Page Rules".
4.) Delete any old Rules for the old domain there. They aren't needed any longer.
5.) Create a new “Rule” with the following settings (replacing "your-old-domain" and "your-new-domain" with your actual domains):
- your-old-domain.com/*
- Choose "Forwarding URL"
- Status Code: 301 - Permanent Redirect
- Destination: https://www.your-new-domain.com/$1
6.) Create a second “Rule” with the following settings (replacing "your-old-domain" and "your-new-domain" with your actual domains):
- www.your-old-domain.com/*
- Choose "Forwarding URL"
- Status Code: 301 - Permanent Redirect
- Destination: https://www.your-new-domain.com/$1
Make sure this second Rule is at the top. They execute in order.
Once you do that, ALL old URLs from your old domain will automatically redirect to the exact same URLs on the new domain.
MAGIC! 🪄 🤩
Again, if any of this is beyond the scope of your knowledge or comfort level, feel free to reach out. I can handle this in under an hour in most all cases. ✨
Stay connected with news and updates!
Join my mailing list to receive the latest news and updates.
We hate SPAM. We will never sell your information, for any reason.