W3 Total Cache uses all the PHP / WordPress API trickery at hand to make sure all static content (CSS, JS, Images, etc.) is served from the CDN URL.

But how does it make sure that even the images referenced in my CSS/stylesheet file are also served from the CDN URL? I checked my CSS file, the path to the images hasn't changed.

It's weird how W3TC does that. Does anyone know?

closed as off-topic by Johannes Pille, Pieter Goosen, cybmeta, birgire, anu Nov 12 '14 at 15:13

This question appears to be off-topic. The users who voted to close gave these specific reasons:

If this question can be reworded to fit the rules in the help center, please edit the question.


Okay, the answer is pretty obvious. Let me explain by example:

  1. W3 Total Cache makes sure that all the primary static contents on a web page (i.e. ones directly referenced in the source of the web page) are loaded via the CDN URL.

  2. So, lets say, W3TC serves the blog's stylesheet from cdn.example.com/wp-content/themes/MY-THEME/style.css and the stylesheet contains this piece of code:

    .expand-down {
        padding-left: 14px;
        background: url(/wp-content/themes/v7/img/right_arrow.png) left center no-repeat;
    #twitter_bird {
        background: url(../themes/v7/img/tech-innovators/twitter_bird.png) no-repeat scroll left top transparent;
        width: 34px;
        float: left;
        height: 24px;
        margin: 9px 0 0 7px;
        display: block;

Since the CSS file has relative references to images' locations. So, the browser simply serves them from the same domain as the domain the one the stylesheet is served from. How did I forget this simple thing?!

Not the answer you're looking for? Browse other questions tagged or ask your own question.