App for Cloudflare® Pro

App for Cloudflare® Pro 1.8.9

Redirecting old WordPress media URLs to new URLs after migrating media to R2

That makes sense, thank you. I'll try that. I had the path correct, but will try the 6.

edit: I had a trailing slash at the end of my domain in the expression, which caused two // in the file path. Fixed that and changed to a 6. Working now.

The only issue now is that any images that were locally in the media folder in sub folders won't display. Would I create additional rules for each subfolder that is in media/, or should I look at just excluding those in R2 caching? The subfolders are static (some created by certain plugins for example).

Thanks!
 
Last edited:
Just as a follow up question to this, is there a way (with rules or some other way) that I could exclude any local /media/subfolder/* directories and files from migrating to the bucket, and also exclude those from being cached, while all other files in the root of the /media/ directory (except subfolders) goes to the bucket?

Thanks again
 
Just as a follow up question to this, is there a way (with rules or some other way) that I could exclude any local /media/subfolder/* directories and files from migrating to the bucket, and also exclude those from being cached, while all other files in the root of the /media/ directory (except subfolders) goes to the bucket?

Thanks again
It’s not so much the local file path, it’s where the individual media (as defined by WordPress’ database) stores it (and its variations). You can move individual media from R2 back to local if you want (click on the media and then click “Edit more details” for the option to move the individual media back and forth).

Internally individual media can be stored locally or in R2 (it’s not an all or nothing situation).

If it’s a ton of media, that isn’t going to be practical to move your exceptions though. How many are you talking about?

Cache Rules definitely can be fine tuned based on path/URI (or however you see fit).
 
Oh thank you. I just realized that I can add additional parameters on your redirect rule that can exclude the sub directories, so that seems to be working on initial testing.

It's not a ton of media as I'm still in beta. I think there's only a couple of hundred images. I think once I exclude all the subdirectories and migrate a few things back to local if needed, that should all be working perfectly.

Thanks for the help, I really appreciate it. It's just taken a little bit for me to wrap my head around CloudFlare settings.
 
Back
Top