How to change Route respond To A specific Path?


To increase site loading time and decrease the pressure on my website I have decided to host files(js,css,images) in other hosting, like google storage or amazon aws, problem is that I already published a lot of posts that includes images other files in the html, like:

<img src="site.example/wp-content/uploads/images/image.png">

i can’t go all over the posts to change the src attribute, so I want to change my route code so every time a wp-content or wp-includes files is requested, it will redirect it to the host where my media files are, something like:

    if(str_contains(path, 'wp-content') || str_contains(path, 'wp-includes')){
ali filali 2 years 2020-10-25T14:10:21-05:00 0 Answers 14 views 0

Leave an answer