How to Redirect an Old Domain to a New Domain Using Cloudflare

If you've recently changed your website's domain name—like moving from sriflix.online
to sriflix.my
—you might worry about losing traffic from old backlinks, such as those shared on Facebook, Twitter, or other platforms. Fortunately, you can set up a redirect to automatically forward visitors from your old domain to your new one using Cloudflare's DNS and redirect tools. This ensures a seamless experience for your users and helps maintain your site's SEO value. In this guide, I'll walk you through the step-by-step process to set up domain forwarding with Cloudflare.
Why Redirect Your Old Domain?
Redirecting your old domain to your new one is crucial for several reasons:
Preserve Traffic: Ensure visitors clicking old links (e.g., from social media) reach your new site.
Maintain SEO: Using a 301 (permanent) redirect signals to search engines that your site has moved, transferring SEO value.
Improve User Experience: Avoid broken links or "page not found" errors for users.
Prerequisites
Before starting, ensure:
You have a Cloudflare account (the free plan works for basic redirects).
Your old domain (e.g.,
sriflix.online
) is registered and its DNS is managed by Cloudflare. If the old domain is no longer registered, you'll need to renew it with your registrar.Your new domain (e.g.,
sriflix.my
) is live and accessible.
Step-by-Step Guide to Set Up Domain Forwarding
Step 1: Add Your Old Domain to Cloudflare
If your old domain isn't already set up in Cloudflare, follow these steps:
Log in to your Cloudflare dashboard.
Click Add a Site and enter your old domain (e.g.,
sriflix.online
).Follow the prompts to update your domain's nameservers at your registrar to Cloudflare's nameservers. This process may take up to 24 hours to propagate, though it’s often faster.
Note: If you no longer control the old domain’s registration, you’ll need to renew or regain access through your registrar before proceeding.
Step 2: Configure DNS Records for the Old Domain
Cloudflare’s redirect rules require a proxied DNS record to handle traffic. Here’s how to set it up:
In the Cloudflare dashboard, select your old domain (e.g.,
sriflix.online
).Go to the DNS tab.
Add the following DNS records:
Root Domain Record:
Type: A
Name:
@
(represents the root domain, e.g.,sriflix.online
)IPv4 Address:
192.0.2.1
(a dummy IP, as redirects don’t rely on this).Proxy Status: Proxied (orange cloud icon).
WWW Subdomain Record (optional, for redirecting
www.sriflix.online
):Type: A
Name:
www
IPv4 Address:
192.0.2.1
Proxy Status: Proxied.
Remove any unnecessary DNS records to avoid conflicts.
Save your changes.
Step 3: Create a Redirect Rule
Cloudflare offers Redirect Rules (recommended) or Page Rules (legacy) to forward traffic. Here’s how to set up a redirect rule:
Using Redirect Rules
In the Cloudflare dashboard, select your old domain.
Navigate to Rules > Redirect Rules.
Click Create Rule and configure it:
Rule Name: E.g., "Redirect sriflix.online to sriflix.my".
When incoming requests match: Select All incoming requests to redirect the entire domain (e.g.,
sriflix.online/about
tosriflix.my/about
).Then:
Type: Dynamic
Target URL:
https://sriflix.my/$2
(the$2
preserves the URL path, e.g.,/about
).Status Code: 301 - Permanent Redirect (best for SEO).
Preserve query string: Enable to keep query parameters (e.g.,
sriflix.online/page?ref=fb
redirects tosriflix.my/page?ref=fb
).
Click Save and Deploy.
Using Page Rules (If Redirect Rules Are Unavailable)
Go to Rules > Page Rules.
Click Create Page Rule.
Configure:
If the URL matches:
sriflix.online/*
(captures all paths).Then the settings are: Select Forwarding URL.
Status Code: 301 - Permanent Redirect.
Destination URL:
https://sriflix.my/$1
(preserves the path).
Click Save and Deploy.
(Optional) Add a second rule for
www
:URL:
www.sriflix.online/*
Forward to:
https://sriflix.my/$1
Status Code: 301.
Step 4: Test the Redirect
Wait a few minutes for DNS changes to propagate.
Test URLs like:
http://sriflix.online
https://sriflix.online
http://www.sriflix.online
https://sriflix.online/some-page
Confirm they redirect to the corresponding
https://sriflix.my
URLs with the same paths.
Step 5: Optimize for SEO
Use 301 Redirects: These tell search engines the move is permanent, transferring SEO value.
Update Backlinks: Where possible, update old backlinks (e.g., on Facebook) to point to
sriflix.my
to reduce reliance on redirects.Monitor with Google Search Console: Add your new domain to Google Search Console to track redirect performance and crawl errors.
Troubleshooting Tips
Redirect Not Working?
Ensure DNS records are Proxied (orange cloud icon).
Verify the redirect rule’s URL pattern (e.g.,
sriflix.online/*
).Clear your browser cache or test in incognito mode.
HTTPS Issues: Enable Always Use HTTPS in Cloudflare’s SSL/TLS > Edge Certificates section.
Old Domain Inaccessible: If you don’t control
sriflix.online
, contact your registrar to renew or regain access.Propagation Delays: DNS changes may take up to 24 hours, though Cloudflare is usually faster.
Final Thoughts
Setting up a domain redirect with Cloudflare is a straightforward way to keep your audience connected to your new site, even if they click old links. By following these steps, you can ensure a smooth transition, preserve your SEO, and avoid losing traffic from backlinks on platforms like Facebook.
If you run into issues or need advanced redirect logic, consider exploring Cloudflare Workers for custom solutions or reach out to Cloudflare’s support. Happy redirecting, and enjoy your new domain!
This guide was inspired by Cloudflare’s official documentation and community resources. For more details, visit Cloudflare’s Help Center.
Subscribe to my newsletter
Read articles from shyzu directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
