I use CDN for my images. I have a custom CNAME so that in the image URL is cdn.mywebsite.com/path/to/my/image/
.
However, my CDN provider does not allow me to copy the path with my custom CNAME by default, so when I copy the URL of the image manually, the link will look like this:
server-a.mycdn.com/path/to/my/image/
Obviously, I don’t want to have image source URLs pointing to my CDN provider, so I only want to rely on my custom CNAME URLs. And changing manually this URL to my custom CNAME is time-consuming.
The easiest solution that comes up to my mind would be to simply find all the references of server-a.mycdn.com
across the site and replace it with cdn.mywebsite.com
upon the build of the site.
How can I achieve it?
I guess this could be achieved with the Replace or ReplaceRE function but I only know how to do this locally on a single string - I don’t know how to make it work across the entire website.