I’m using a CDN for serving my images on my WordPress..

The URL structure goes as such:

//mydomain.com/assets/uploads/[year]/[month]/[day]/[imagename].png or whatever

For my CDN the images are served as:

//cdn.cdnnetwork.com/mydomain.com/assets/uploads/[year]/[month]/[day]/[imagename].png or whatever

Now the problem is that whenever the image gets accessed directly either with typing in the exact url or a search engine redirecting it they all go to:

//mydomain.com/assets/uploads/[year]/[month]/[day]/[imagename].png or whatever

I want to use .htaccess rule or any other way to redirect all

//mydomain.com/assets/uploads/[year]/[month]/[day]/[imagename].png or whatever

links to:

//cdn.cdnnetwork.com/mydomain.com/assets/uploads/[year]/[month]/[day]/[imagename].png or whatever

So I can save bandwidth… Is it possible? The images embedded in a actual webpage using the img tag are fine it’s just direct access to the images.

Sorry I’m new to this site and I really don’t know what I’m doing so please excuse my mistakes. Any help would be great!

Read more here: Redirect all image urls to my CDN – WordPress


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: