Guide, checked November 2026
How to redirect a domain with Cloudflare, no server needed
Cloudflare will redirect a whole domain on its free plan, over HTTPS, with the path and query string intact. You need three things: the domain on Cloudflare’s nameservers, a placeholder DNS record, and one Redirect Rule. This page walks through them, shows how to test, and says when a different tool fits better.
- A @ 192.0.2.1ProxiedRecord
- Redirect Rule301, path keptRule
- https://olddomain.com/a?b=1newsite.com/a?b=1Works
Short version
If you can move the domain’s nameservers to Cloudflare and you are comfortable writing a rule, this is the best free way to redirect a domain. It gets heavy when you have dozens of domains, because each one is its own zone with its own rule. It does not work at all when DNS has to stay with a central IT team or another provider. And it is a poor fit when marketing colleagues need to change destinations and see traffic without a Cloudflare login.
Written by the SiteDetour team. Checked against Cloudflare’s documentation page "Redirect one domain to another" on 10 November 2026.
Trusted by universities, government agencies, credit unions and brands since 2019
Set up the redirect in Cloudflare
About fifteen minutes of work, plus the wait for the nameserver change.
Add the domain to Cloudflare
Add olddomain.com as a site on the free plan, then change the nameservers at your registrar to the two Cloudflare gives you. If the domain receives email, copy the MX records across before you switch.
Create placeholder DNS records
Add an A record for @ pointing to 192.0.2.1, and a second one for www. Set both to Proxied. The address goes nowhere. It is there so Cloudflare has traffic to apply the rule to.
Create a Redirect Rule
Under Rules, create a Redirect Rule. Match on Hostname equals olddomain.com, and add www.olddomain.com with Or so both names are covered.
Write the target
Set Type to Dynamic and the expression to concat("https://www.newsite.com", http.request.uri.path). Choose status code 301 and turn on Preserve query string.
Deploy and wait for the nameservers
Save the rule. Nothing happens until the nameserver change has taken effect. After that, Cloudflare issues the certificate for the old domain on its own.
The two mistakes behind most "it does not redirect" posts: the DNS record is set to DNS only, so the rule never runs, or there is no www record, so only the bare domain works.
Cloudflare next to a hosted redirect
Both do the core job well. The differences are in where DNS lives and who can manage it.
- A @ set to DNS onlyfails:the rule never runs
- www.olddomain.com, no recordfails:only the bare domain works
- no rule matches the hostnamefails:error 522
- https://olddomain.com/a?b=1works:newsite.com/a?b=1
- https://www.olddomain.com/a?b=1works:newsite.com/a?b=1
- https://olddomain.com/a?b=1works:newsite.com/a?b=1
Test both halves before you trust it
Run these from any terminal. Replace olddomain.com with yours.
$ curl -sI http://olddomain.com | head -3HTTP/1.1 301 Moved PermanentlyLocation: https://www.newsite.com/$ curl -sI "https://olddomain.com/pricing?ref=test" | head -3HTTP/2 301location: https://www.newsite.com/pricing?ref=testBoth commands should print a 301. The second one checks that the path and the query string arrive intact. An error 522 means the request reached Cloudflare but no rule matched it, so Cloudflare tried the placeholder address. Check the hostname in the rule. If you have no terminal handy, paste the address into the free redirect checker and read the chain.
Test www and the bare domain separately. They are two hostnames to Cloudflare, and it is common for one to work while the other times out.
When Cloudflare is the wrong tool
It is a good free option. These are the cases where teams end up using something else.
You cannot move the nameservers
The domain’s DNS is run by central IT, a parent company or another provider, and nobody is going to hand a zone to Cloudflare for the sake of one redirect.
Common at: universities, public bodies, subsidiaries.
You have dozens of domains
Every domain is a separate zone to add, with its own records and its own rule. It works. It is also a lot of clicking unless someone scripts it with the API or Terraform and keeps that script alive.
Common at: brand portfolios, companies that acquire other companies.
What SiteDetour does differently
DNS stays where it is. You add an A record or a CNAME per domain. Every redirect sits in one list with path rules, CSV import, hit reports, team roles and SSO, and nobody needs a Cloudflare login to change a destination.
From $12 a month for 5 domains. 14 day trial, no credit card.
Move a Cloudflare redirect to SiteDetour
About ten minutes per domain, most of it waiting for DNS.
Create the redirect
In SiteDetour, open Redirects and click Create New. Enter olddomain.com as the domain, set the destination, and tick Include www subdomain.
Copy the DNS values
Click View DNS Instructions. The panel lists the A records for the bare domain and the CNAME target for subdomains. Keep it open.
Swap the records in Cloudflare
Replace the 192.0.2.1 placeholder records with the records from the panel and set them to DNS only, so requests reach SiteDetour directly. Then delete the Redirect Rule.
Issue the certificate
Back in SiteDetour, click Acquire SSL certificate once DNS has updated. Subdomains usually update within five minutes. Bare domains can take up to 24 hours, depending on the old TTL.
Run the test again
Both curl commands should now print a 301. Renewals happen on their own after that.
Questions that come up
Is redirecting a domain with Cloudflare free?
Why does the DNS record point to 192.0.2.1?
Why do I get error 522 on my redirect?
Do I have to move my nameservers to Cloudflare?
Does a Cloudflare redirect keep the path and query string?
Do I have to keep paying for the old domain?
If you can move the nameservers and write a rule, this is the best free way to redirect a domain. It gets heavy when you have dozens of domains.
Redirect your first domain in about ten minutes
Add the domain, copy the DNS records, and the certificate is issued for you. 14 days free, no credit card.
- 14 day free trial
- No credit card
- No traffic metering