Skip to content

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.

olddomain.com on CloudflareResult
  • 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

  • Hard Rock Hotels
  • UNIQLO
  • Major League Baseball
  • Whole Foods
  • University of New Mexico
  • University of Illinois Chicago
  • NYC Department of Cultural Affairs
  • Florida Today
  • British Rail Engineering
  • IR Energy Systems

Set up the redirect in Cloudflare

About fifteen minutes of work, plus the wait for the nameserver change.

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

Cloudflare with one of the common mistakesThe causes behind most posts that say it does not redirect
  • 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
Cloudflare with proxied records and one ruleCertificate issued once the domain is on its nameservers
  • https://olddomain.com/a?b=1works:newsite.com/a?b=1
  • https://www.olddomain.com/a?b=1works:newsite.com/a?b=1
Through SiteDetourDNS stays where it is, with an A record or a CNAME per domain
  • https://olddomain.com/a?b=1works:newsite.com/a?b=1
http:// requests
Cloudflare, free planRedirected
SiteDetourRedirected
https:// requests
Cloudflare, free planCertificate issued by Cloudflare once the domain is on its nameservers
SiteDetourCertificate issued and renewed for every domain
Redirect types
Cloudflare, free plan301, 302, 307, 308
SiteDetour301, 302, 307
Destinations
Cloudflare, free planRules written as expressions. Path and query can be kept.
SiteDetourRules per path, with path and query forwarding
Where DNS lives
Cloudflare, free planMust move to Cloudflare nameservers
SiteDetourAny provider. You add an A record or a CNAME.
Traffic reports
Cloudflare, free planAnalytics per zone in the Cloudflare dashboard
SiteDetourHits, countries, referrers and devices, live
Cost
Cloudflare, free planFree. The number of rules depends on your plan.
SiteDetourFrom $12 a month for 5 domains

Test both halves before you trust it

Run these from any terminal. Replace olddomain.com with yours.

Terminal
$ 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=test

Both 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.

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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?
Yes. Redirect Rules are available on the free plan, and the certificate for the old domain is included. How many rules you can have depends on the plan, so check Cloudflare’s current limits if you plan to redirect many paths.
Why does the DNS record point to 192.0.2.1?
It is a reserved address that does not lead to any server. Cloudflare’s documentation uses it as a placeholder so that a proxied record exists and redirects can be applied to the traffic. The IPv6 equivalent for an AAAA record is 100::.
Why do I get error 522 on my redirect?
No rule matched the request, so Cloudflare tried to reach the placeholder address and timed out. The usual causes are a typo in the hostname, a rule that covers the bare domain but not www, or a rule that was saved as a draft.
Do I have to move my nameservers to Cloudflare?
On the free plan, yes. Redirect Rules only run on records that Cloudflare proxies, and that needs the domain’s DNS on Cloudflare. If the nameservers cannot move, point an A record or CNAME at a redirect host from wherever your DNS lives now.
Does a Cloudflare redirect keep the path and query string?
It does when you build the target with a dynamic expression that appends http.request.uri.path and turn on Preserve query string. A static target sends every request to one fixed address.
Do I have to keep paying for the old domain?
Yes, for as long as the redirect should work. If the registration lapses the redirect stops, and anyone can register the name and receive your old traffic. Most teams leave redirected domains on auto renew for years.

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