I am working on website and trying to use cdn filepath for all media files. I already copied media library files into s3 bucket and they work good. Problem is, I tried to update database by using
update wp_posts set post_content = REPLACE(post_content, 'http://example.com/wp-content/uploads', 'http://s3.amazonaws-mywebsitelink.com/wp-content/uploads');
it did not change anything.
I want that my website should display the media files from that Amazon s3 bucket link.
For example;
http://mywebsite/wp-content/uploads/2022/06/2568.png But I want Wordpress to read this attachment from http://s3.amazonaws-mywebsitelink.com/wp-content/uploads/2022/06/2568.png
These urls are not real.
Then i tried to use
define('WP_CONTENT_URL', 'http://s3.amazonaws-mywebsitelink.com/wp-content/uploads');
then all the image files are broken for website. I rolled it back. How can i do this change?
I also thought of using this solution but this way HTML page will load all images twice first for local images and then CDN images. That is not what i wanted.
Edit about new uploads: When i upload a new file, it automatically gets the s3 url and works. But even if i got premium and activated the rewrite option for Offload Media Lite plugin for s3, they still stays like local urls of my wordpress. So my problem is with previous images. I have to change them manually, i think.
Please help, thanks.