smol projects

cloudflare single redirect

16.08.2023 1 min read

What 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…”

Your expression preview should look like this:

(http.request.full_uri eq "https://bnjmn.me/resume")

Save it, and everything should redirect as expected 🔥

Built with Astro and Tailwind 🚀