Cloudflare

Cloudflare

Cloudflare Redirect Cheatsheet

This guide explains how to set up redirects in Cloudflare to achieve the following:

  1. Redirect your *.pages.dev subdomain to your custom domain.
  2. Redirect www to your apex (root) domain.

Steps to Set Up Bulk Redirects in Cloudflare

  1. Go to Bulk Redirects:

    • Log in to your Cloudflare dashboard.
    • From the main navigation menu, select Bulk Redirects.
  2. Create a New Bulk Redirect List:

    • Click Create a new list.
    • Add the following redirects:
      1. Redirect from *.pages.dev:

        • Source URL: cyberthingsde.pages.dev
        • Target URL: https://cyberthings.de
        • Enable the following options under “Edit parameters”:
          • ✅ Preserve query string
          • ✅ Subpath matching
          • ✅ Preserve path suffix
        • Set the status code to 301 (Permanent Redirect).
      2. Redirect from www to Apex Domain:

        • Source URL: www.cyberthings.de
        • Target URL: https://cyberthings.de
        • Enable the following options under “Edit parameters”:
          • ✅ Preserve query string
          • ✅ Subpath matching
          • ✅ Preserve path suffix
        • Set the status code to 301 (Permanent Redirect).
  3. Save and Deploy:

    • Save the list and create a new Bulk Redirect Rule.
    • Assign this list to the rule and activate it.

Below is an example screenshot of how your Bulk Redirect List should look:

Cloudflare Bulk Redirect Example