Redirecting Your Domains using Cloudflare

ยท

2 min read

I was not available for some time, so I haven't written about anything in a long time, recently I bought a new domain so I had to redirect my old domain and its subdomains to my new domain, This small blog is about how to do that.

I recently had to redirect my .me domain to .in domain, so I had to do Cloudflare domain redirects. Here is how to do it.

Adding DNS Records

First, you need to add some DNS Records, follow this table and create new records or edit your existing records.

TypeNameContentProxy StatusTTL
A*192.0.2.1ProxiedAuto
A@192.0.2.1ProxiedAuto

You should not edit non-conflicting Records until you know what you are doing

Setting Up Page Rules

Once you have DNS setup, go to Rules > Page Rules, Add a new rule with the config defined below,

URL: *olddomain.com/*
Setting: Forwarding URL
Status Code: 301 / 302
Destination URL: https://$1newdomain.com/$2

Now save the page rule and enable if already not enabled, This might take up to an hour to reflect on all devices due to DNS Caches.

Effects

With this config all URLs and subdomains of olddomain.com will be redirected to newdomain.com

FromRedirected To
https://olddomain.comhttps://newdomain.com
https://olddomain.com/anypage?with=query_stringhttps://newdomain.com/anypage?with=query_string
https://www.olddomain.comhttps://www.newdomain.com
https://anything.olddomain.comhttps://anything.newdomain.com

Sources

it's Blank Particle, Signing Out ๐Ÿ‘‹

ย