WordPress.org

Ready to get started?Download WordPress

Forums

W3 Total Cache
Compression on self hosted CDN? (16 posts)

  1. bhagwad
    Member
    Posted 4 years ago #

    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?

  2. Frederick Townes
    Member
    Plugin Author

    Posted 4 years ago #

    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?

  3. bhagwad
    Member
    Posted 4 years ago #

    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?

  4. bhagwad
    Member
    Posted 4 years ago #

    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?

  5. bhagwad
    Member
    Posted 4 years ago #

    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>
    <IfModule mod_mime.c>
        AddEncoding gzip .gzip
        <Files *.css.gzip>
            ForceType text/css
        </Files>
        <Files *.js.gzip>
            ForceType application/x-javascript
        </Files>
    </IfModule>
    <IfModule mod_deflate.c>
        <IfModule mod_setenvif.c>
            SetEnvIfNoCase Request_URI \.gzip$ no-gzip
        </IfModule>
    </IfModule>
    <IfModule mod_headers.c>
        Header set X-Powered-By "W3 Total Cache/0.9.1.1"
        Header set Vary "Accept-Encoding"
        Header set Pragma "public"
        Header set Cache-Control "public, must-revalidate, proxy-revalidate"
    </IfModule>
    <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]
    </IfModule>
    # END W3TC Minify
  6. Frederick Townes
    Member
    Plugin Author

    Posted 4 years ago #

    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.

  7. bhagwad
    Member
    Posted 4 years ago #

    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: http://www.bhagwad.com/blog/2010/personal/never-use-dishwashing-liquid.html

    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...

  8. Frederick Townes
    Member
    Plugin Author

    Posted 4 years ago #

    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.

  9. bhagwad
    Member
    Posted 4 years ago #

    Thanks for the reply Frederick.

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

    "Create static.domain.com on your server (and update your DNS zone) and then specify the FTP details for it"

    Isn't this what you meant?

  10. Frederick Townes
    Member
    Plugin Author

    Posted 4 years ago #

    My directions recommend subdomain.domain.com not domain.com/cdn/ for domain name.

  11. bhagwad
    Member
    Posted 4 years ago #

    I think we misunderstood each other.

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

    Isn't that what you meant?

  12. Frederick Townes
    Member
    Plugin Author

    Posted 4 years ago #

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

  13. bhagwad
    Member
    Posted 4 years ago #

    Thanks Frederick

  14. Frederick Townes
    Member
    Plugin Author

    Posted 4 years ago #

    You're welcome.

  15. nick_nielsen
    Member
    Posted 3 years ago #

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

  16. Frederick Townes
    Member
    Plugin Author

    Posted 3 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic