Cloudflare Docs
Rules
Rules
Edit this page
Report an issue with this page
Log into the Cloudflare dashboard
Set theme to dark (⇧+D)

Redirect requests from one country to another domain

In this example, all website visitors from the United Kingdom will be redirected to a different domain, but maintaining current functionality in the same paths.

  1. Create a Bulk Redirect List named uk_redirect_list with the following URL redirect:

    • Source URL: https://example.com/
    • Target URL: https://example.co.uk/
    • Subpath matching: Enabled
    • Preserve query string: Enabled
  2. Create a Bulk Redirect Rule that enables the previous Bulk Redirect List and set the rule expression to the following:

    ip.src.country == "GB" and http.request.full_uri in $uk_redirect_list

This configuration will perform the following redirects for UK visitors:

Request URLURL after redirect
https://example.com/https://example.co.uk/
https://example.com/my/path/to/page.htmhttps://example.co.uk/my/path/to/page.htm
https://example.com/search?q=termhttps://example.co.uk/search?q=term