Change your domain name without losing rankings with Cloudflare

TABLE OF CONTENTS
When you change the domain name of your website, it's important to implement the correct redirects to ensure that you don't lose your search engine rankings.
Cloudflare is a free tool that can help you do 301 redirects, which are the best type of redirects for domain name changes.
Make a backup of your old website. Then it pushes to the new domain name, or localhost to test errors.
Make sure that the old domain name is still valid so that the redirection to the new domain name is not interrupted. Because this process can take a few days or months depending on the number of indexed links of the old web.
You do not need to use hosting for the old domain name. This redirection is done through Cloudflare.
A 301 redirect is a type of HTTP redirect that indicates that a website's URL has changed permanently.
When Googlebot or other search engines visit a website with a 301 redirect, they notice that the URL has changed and update their index to reflect the new URL.
This ensures that users can still find your website in search results, even if they have saved a link to your old URL.
There are several benefits to using 301 redirects when you change the domain name of your website, including:
To perform a 301 redirect using Cloudflare, you need to follow these steps:
Go to your Cloudflare account and click on the domain name you want to redirect.
If you want to use redirects that no need hosting then must add A record to any IP. My example is 1.2.3.4
Find the section Rules and click Page Rules.
old-domain.com/*
https://new-domain.com/$1
Now check by accessing the old domain name. You will be redirected to the new domain name immediately.
Page Rules Cloudflare is deprecated
The alternative is to use Redirect Rules
Custom filter expression
Hostname equals "old-domain.com"
(http.host eq "old-domain.com")
Item Then
:
Dynamic
concat("https://new-domain.com", http.request.uri.path)
Preserve query string
so that queries are preserved when redirected.Deploy
to save.You need to add the new domain name to the Google Search Console tool.
From the old domain management interface → Select Settings → Change of address.
Select the new domain you need to redirect → Click VALIDATE & UPDATE.
So it's done. The rest is to wait or you can index manually quickly. It took me 2 hours to redirect and a few posts appeared already.
In addition to using 301 redirects, you can also notify your users that you are switching to a new domain. You can send notifications via email or on social networks.
Before canceling the old domain name you also need to check if there are any unredirected URLs by typing in the search bar: site:domain.com
Related Articles