Does Cloudflare workers redirect works with wild card(*, $1)

Hi,

I have doubts regards to Cloudflare workers. Do Cloudflare workers redirect works with the wild card(*, $1)

Path —> example.com/kids/toys/*
Redirect to —> example.com/kids/*

E.g:
example.com/kids/toys/lego.html —> example.com/kids/lego.html

You should be able to write a worker to redirect these requests, yes.

You’ll probably need to bring Regex into it to create the substitution URL, but it’s a fairly simple Regex.

It’s worth noting that if you do not want to go down the Workers route then you can achieve this quite easily using only Page Rules (3 provided on the Cloudflare Free plan).

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.