• Resolved issacchua

    (@issacchua)


    Hello,

    I know this might sound a little weird, but I would like to configure W3TC to continue uploading to my S3 bucket automatically, but I don’t want my webpage to serve the image files from S3.

    The reason I am asking this is because I want to test the page load if images are loaded from S3 vs locally (without S3). If later on I decide to go switch back to S3, I can just simply change the configuration on the master.php.

    Is that something possible? Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @issacchua

    Thank you for reaching out and I am happy to assist you with this.
    You can exclude specific folders and files from being uploaded to the CDN and also, you can remove the extensions of the theme files you do not want to be uploaded to the CDN.
    In Performance>CDN>Advanced, remove all image files extensions from:
    wp-includes file types to upload:
    Theme file types to upload:

    Aso, in the Rejected files list, add the path of the files/folder you wish to exclude:
    for example /wp-content/uploads/

    I hope this helps!

    Thread Starter issacchua

    (@issacchua)

    Hi Marko,

    Thanks for your reply. I actually wanted the images to upload to CDN, however, on the website, we still display the file served from local. (I know I know, it is a weird request to ask…)

    So to give an example, when I upload a file in media library, I would like the file to be uploaded to CDN as well. However, on my web page that displays the image, I want that image to load from local host instead of CDN. Hopefully, there is an option that allowed me to do such switch.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @issacchua

    Thank you for your feedback.
    As I’ve mentioned in the previous post, you can add the path of the file you wish to exclude being served from the CDN in Prerformance>CDN>Advanced>Rejected files:
    for example:
    /wp-content/uploads/2022/02/image.jpeg
    make sure to save all settings and purge the cache.
    Thanks!

    Thread Starter issacchua

    (@issacchua)

    Yes, that works! Thanks Marco!

    I need to figure out the regex to exclude everything in the upload directory with different subdirectories now.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @issacchua

    You are most welcome.
    You can use placeholders and exclude specific directories:

    {uploads_dir}/date/sub-folder1/
    {uploads_dir}/date/sub-folder2/

    Thanks!

    Thread Starter issacchua

    (@issacchua)

    Hi Marko,

    It actually can be as simple as:

    /

    I am using this works as well:

    ^(.*\/)([^\/]*)$

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Upload to CDN without loading from CDN’ is closed to new replies.