Saving a HUGE bandwidth cost in WordPress by automatically serving media contents from

14 thoughts on “Saving a HUGE bandwidth cost in WordPress by automatically serving media contents from”

  1. have to try it out. Looks exciting😀
    একটা ছোট্টো টাইপো সম্ভবত ভাইয়া – in the last potion, shouldn’t it be “Now I owe you a surprise” instead of “Now you owe me a surprise” ?

  2. Boss, is it still working?? I’ve created a publicly shared folder in my account, uploaded some images in that public folder, but when I try to access any image via url, that url loads the file viewer page instead of serving the image over http. Or I’m missing any other configuration/setting in account to achieve this??

    1. I’ve verified that, static file serving only works with http protocol, accessing files via https protocol loads the file in a hosted viewer page in

      You may want to update the post to mention about this as well as changing the wordpress filter to something like below:

      function link_replacer($content){
      return preg_replace(“#http(s)?://” . preg_quote(‘your_wordpres_blog_url/wp-content/uploads/”,
      “”, $content);

      Also it might be worth noting that, all text files are served with text/plain mime types, even though the file extension is css or html or js

    2. Correction in above code:

      function link_replacer($content){
      return preg_replace(‘#http(s)?://’ . preg_quote(‘your_wordpres_blog_url/wp-content/uploads/’,’#’) . ‘#m’,
      “”, $content);

    3. Shihan bhai, for me it’s perfectly working via http and https. Please make sure that you had shared the folder publicly.

      Please see the following URL, it contains an https

      and displays directly in the browser.

    4. Interesting!! Now when I tried it again, it is working as expected. May be I was doing something wrong while building the url. Anyway, thanks for the great idea & sharing it.

      BTW, I would be more happy, if static text files could also be served from with appropriate mime type and I could move the css & js files along with the images there. If you can figure out an way for this, please share as well.

      Thanks again (Y)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s