Support » Plugin: W3 Total Cache » [Plugin: W3 Total Cache] Compression on self hosted CDN?

  • First, I’d like to thank the plugin author for a brilliant plugin. Absoluuutely brilliant and it does more for me than I have any right to expect.

    I’m just having a minor issue with my self hosted CDN setup. The .css and .js files are being served from the CDN, but they’re not being compressed. But if I disable the CDN altogether, then the files are being sent in compressed format from the regular host – no problem.

    I’ve enabled compression in the w3 cache options for all file types.
    I’m on a Godaddy shared hosting plan and server side mod_deflate/gzip isn’t enabled for me.

    Is this by design?

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Author Frederick Townes


    Can you check and make sure that there is an .htaccess file on your subdomain? Can you paste it here or submit a bug submission form from the support tab of the plugin?

    I checked and there isn’t a .htaccess file on the subdomain! The subdomain is just a folder on the main domain, so I didn’t know I would need one. Clearly I seem to be wrong.

    Which .htaccess file shall I put into it to make it work like it should?

    I just saw your comment on another forum to use the wp-content/plugins/w3-total-cache/ini/_htaccess file in the subdomain, but there isn’t any such file.

    I guess the updated version doesn’t have it?

    I added this .htaccess file from the “Install” section of the plugin to the subdomain folder – it still didn’t send it compressed:

    # BEGIN W3TC Minify
    <IfModule mod_expires.c>
        ExpiresActive On
        ExpiresByType text/css M3600
        ExpiresByType application/x-javascript M3600
    <IfModule mod_mime.c>
        AddEncoding gzip .gzip
        <Files *.css.gzip>
            ForceType text/css
        <Files *.js.gzip>
            ForceType application/x-javascript
    <IfModule mod_deflate.c>
        <IfModule mod_setenvif.c>
            SetEnvIfNoCase Request_URI \.gzip$ no-gzip
    <IfModule mod_headers.c>
        Header set X-Powered-By "W3 Total Cache/"
        Header set Vary "Accept-Encoding"
        Header set Pragma "public"
        Header set Cache-Control "public, must-revalidate, proxy-revalidate"
    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /blog/wp-content/w3tc/min/
        RewriteCond %{HTTP:Accept-Encoding} gzip
        RewriteRule .* - [E=APPEND_EXT:.gzip]
        RewriteCond %{REQUEST_FILENAME}%{ENV:APPEND_EXT} -f
        RewriteRule (.*) $1%{ENV:APPEND_EXT} [L]
        RewriteRule ^([a-f0-9]+)\/(.+)\.(include(\-(footer|body))?(-nb)?)\.[0-9]+\.(css|js)$ index.php?tt=$1&gg=$2&g=$3&t=$7 [L]
    # END W3TC Minify

    Plugin Author Frederick Townes


    I’m not clear on how you’re using the self-hosted CDN. It’s not going to work properly if you’re using a directory on the same domain as your web site. Compression also won’t work if your server is missing mod_deflate module for apache.

    I’ve created a sub domain which is actually a directory on the same domain. It works quite well and in fact, I’m using it now for image hosting. I’d also like to host my static js and css files on it but as I said, they aren’t served compressed from the CDN.

    To see how the images are being served from my subdomain, see the pictures source in this post:

    My server doesn’t support mod_deflate since it’s only a shared Godaddy Hosting – but the files are served compressed without a CDN. I’m not sure how this works…

    Plugin Author Frederick Townes


    Well if your server is missing the modules, then it cannot be done. Also there is no benefit to use the same domain, I really do not recommend it, you’ve defeated the purpose of the feature completely.

    Thanks for the reply Frederick.

    But in the W3 help section, you’ve recommended just this! From the FAQs

    “Create on your server (and update your DNS zone) and then specify the FTP details for it”

    Isn’t this what you meant?

    Plugin Author Frederick Townes


    My directions recommend not for domain name.

    I think we misunderstood each other.

    That’s what I’m doing. I’ve created a subdomain The files for are in a folder on the same shared server.

    Isn’t that what you meant?

    Plugin Author Frederick Townes


    The document root should be used, subdirectories are not officially supported.

    Thanks Frederick

    Plugin Author Frederick Townes


    You’re welcome.

    I think I understand the confusion.
    I’ve just created a subdomain which my host tells me is, but for uploading files it appears as a folder with the name mysubdomain in my root directory.

    Plugin Author Frederick Townes


    @nick_nielsen, so you’re all set then? As that scheme is fine.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘[Plugin: W3 Total Cache] Compression on self hosted CDN?’ is closed to new replies.