Migrate Forwarding URL (from local asset path to CDN asset path)

Hi all,

I need help with migrating my current forwarding rule with Page Rules to new Redirect Rules. I am currently forwarding

from

*mydomain.com/wp-content/uploads/*

to

https://cdn.mycdn.com/file/client-cdn/mydomain/wp-content/uploads/$2

I have already checked out the migration guide at Page Rules migration guide · Cloudflare Rules docs but I can’t relate it to my case.

Any help is appreicated, thanks!

I see you’re just adding the existing path to a new hostname and path start. To do this:

IF hostname CONTAINS mydomain.com
AND path STARTS WITH /wp-content/uploads/

Dynamic Redirect: concat("https://cdn.mycdn.com/file/client-cdn/mydomain", http.request.uri.path)

2 Likes

I omitted the first part IF hostname CONTAINS mydomain.com. I just used

(starts_with(http.request.uri.path, "/wp-content/uploads/"))

and it works as well. Thank you for pointing me in the right direction.

1 Like

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