Serving Wp-Content from s3/Cloudfront/Other Server

I want to rename the wp-content folder, and then serve it from a different server maybe s3/cloudfront.

I tried uploding entire wp-content directory to s3,
define( 'WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/' );
define ('WP_CONTENT_URL','');

I also want to not use a plugin for this. So a little bit of .htaccess jugglery is in order.

Any ideas? Is this even possible? Has anyone done this?

  • Tom Eagles


    I am pretty sure this would be impossible because of the following.

    WordPress uses PHP's include etc. to process other PHP files. Although you can use URLs to specify included files, if you do that the included files which will be on your s3 server may be looking for the includes there not back the original part.

    Kind of curious why you would want to do this unless it's a space issue.

    However one of our server experts @aecnu may be able to come up with something, he's my host also and if its possible this guy will find a way he's awsome.



  • mort3n

    Hi gecko123,

    As Tom said, I'm don't know what you want to achieve by your approach. If it is the speed of using a CDN, then I have very good experiences with the combination of the W3 Total Cache plugin and a CDN.

    Searching turns up a number of tutorials on how to set things up. Here is one

    I'm a CDN newbie, but it seems that some CDNs offer to store your content. I have chosen to store it at my host and have the CDN mirror the content to their servers.

    Hope it helps

    EDIT: @gecko123 We cross-posted :slight_smile:

  • aecnu

    Greetings Tom, gecko123, and mort3n,

    I must admit that I am down on CDN's and caching as a whole and wholeheartedly believe if ones servers are robust enough there is nothing to be gained by either of the previously mentioned items though I am all for browser caching and compression making the end users computer part of the delivery network by having crushing cpu's compress the file whipping it across the net allowing the end users computer do the decompressing and therefore adding there PC into the equation of site delivery.

    There are only two instances I can think of that I would consider using server side caching, one being a million hits a month plus and the other being on Blue Host because they use bandwidth throttling to control bandwidth usage.

    Unlimited bandwidth through a straw rather then through a fire hose - what a farce the unlimited bandwidth claim quickly becomes when you consider this fact.

    Nothing but nothing beats adequately configured servers that are configured correctly in both software and hardware.

    Thank you for allowing me to add my two cents and for being WPMU DEV Community Members!

    Cheers, Joe

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.