If you’ve got more than one domain (such as example.co.uk, example.uk, example.io etc.) that you want to be redirected to the same site (example.com), then it can easily be configured using Cloudflare’s PageRule functionality.
This guide assumes you’re already using Cloudflare’s services for all the domains to be redirected and have caching/performance enabled (i.e. not DNS only). If not, go follow this guide from Cloudflare
- Navigate to the “Page Rules” tab for the domain to be redirected
- Click “Create Page Rule” button
- Enter the following as the URL criteria: domaintoberedirected.tld/
- Click “Add a Setting” link
- Choose “Forwarding URL” dropdown
- Select the status code of your preference, either permanent or temporary (if you want to revert back in the future)
- Enter the destination URL from the following examples
- 7a) To have the rest of the URI structure maintained (i.e. domaintoberedirected.tld/page1 -> domain.tld/page1) use: https://domain.tld/$2 (replacing https with http and/or domain.tld with www.domain.tld if desired)
- 7b) To have all pages redirect to the same location (i.e. domaintoberedirected.tld/page1 -> domain.tld) use: https://domain.tld/oldbrandblogpost (replacing https with http and/or domain.tld with www.domain.tld and/or changing the specific page if desired)
- Repeat steps 4 through 7, with the URL criteria of .domain.tld/
You can then check the results by browsing to the old domains, which should now be redirected.
If it doesn’t work, triple check the settings for your domain have caching and performance enabled (orange cloud).