cloudflare single redirect
16.08.2023 1 min readWhat we’re going to do: use Cloudflare to create a redirect from a request to wherever you want your link to go.
E.g. https://bnjmn.me/resume will lead visitors to https://rxresu.me/benjacoblee/webdev
(Using a URL shortener is probably much easier, but moving on…)
- In Cloudflare, choose your site.
- In the left-hand panel, click on “Rules”. In the expanded toggle, click on “Redirect Rules”.
- Click on the “Create Rule” button.
- In “Rule name (required)”, give it a descriptive name, e.g. “Redirect resume request on apex domain to file hosted on nginx”
- Choose “Custom filter expression”.
- “When incoming requests match…”
- Field - choose “URI Full”
- Operator - choose “equals”
- Value - https://bnjmn.me/resume
Your expression preview should look like this:
(http.request.full_uri eq "https://bnjmn.me/resume")
- “Then…”
- Type - choose “static”
- URL - the redirect URL. Mine was https://rxresu.me/benjacoblee/webdev
- Status code - 301
Save it, and everything should redirect as expected 🔥
Built with Astro and Tailwind 🚀