Redirect to using Single/Dynamic Redirects


Redirect to (www subdomain to root/apex) using Single Redirects (also called Dynamic Redirects).

  • Have an active and setup website in Cloudflare. Transfer your website to Cloudflare today, or use the Cloudflare Registrar to register a new domain.

  • I will be using in place of your real domain. Anytime this used, please replace it with your own domain.


  1. Navigate to your website in Cloudflare, and then to DNS → Records. Magic link.

  2. Add a new record. The type should be AAAA (IPv6 type), the name should be www (www subdomain), the IPv6 Address/value should be 100:: (IPv6 Discard, if nothing handles the traffic in Cloudflare, it won’t go anywhere), and Proxy Status should be on :orange:.

    Make sure to click Save.
    This will allow traffic to flow into Cloudflare and hit your Redirect. Cloudflare will serve its own Proxy IPs at edge, so both IPv4 and IPv6 Clients (everyone) will be able to connect.

  3. Navigate to Rules → Redirects → Create Rule. Magic link

  4. Create your Redirect Rule. Give it a name, like www redirect to root, and select Field: Hostname Operator: equals, Value:
    Under “Then… URL Redirect”, change Type to Dynamic and add the following expression concat("", http.request.uri.path), check Preserve Query String. Replace any mention of with your own domain.

    Then click Deploy.

  5. Wait a few minutes and test the redirect by visiting your site.


  • Please note that due to DNS Cache, you may not be able to instantly connect see the redirect. It may take an hour or so. Your Default DNS Resolver, usually operated by your Internet Service Provider, may cache for longer. Consider switching to Cloudflare’s DNS Resolver today, for fast and privacy respecting DNS. Setup instructions: — the Internet’s Fastest, Privacy-First DNS Resolver
    This will manifest with errors such as “We’re having trouble finding this site” or ERR_NAME_NOT_RESOLVED or DNS_PROBE_FINISHED_NXDOMAIN.

  • If you would like to provide any feedback on this tutorial, please post in the #Meta category, tag your post #TutorialFeedback.


This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.