WordPress.org

Ready to get started?Download WordPress

Forums

W3 Total Cache
Plugin: WordPress-HTTPS] W3TC cache URL issue over SSL (4 posts)

  1. Sam
    Member
    Posted 2 years ago #

    I am using version 3.3.2 of WordPress with version 0.9.2.4 of W3 Total Cache and version 3.0.3 of WordPress-HTTPS (the newest versions as of writing this). I have page caching (disk: enhanced), minify (auto, disk, HTML: default, JS: JSMin (default), CSS: Default), database cache (disk), and object cache (disk), and browser cache enabled in W3TC. WordPress-HTTPS is configured to use a subdomain for HTTPS (i.e. secure.domain.com) and the WordPress Address and Site Address in WordPress General Settings are set to http://www.domain.com

    The SSL certificate was created for the specific secure subdomain (so https connections to http://www.domain.com or domain.com won't load) and SSL connections (using the secure subdomain) work correctly for everything except for W3TC's cache files. The CSS cache file tries to load using an absolute URL at https://www.domain.com/wp-content/w3tc/min/025baa35.a78352.css (instead of https://secure.domain.com) so it doesn't load—everything using a relative URL (/wp-content/etc/etc) loads correctly using the secure subdomain over https. The Javascript cache file doesn't even try to load at all (there is no link to it in the head). To be clear, when not using an https connection, W3TC uses relative URLs to load the W3TC CSS and Javascript cache files and they both appear in the head (that is, everything loads as it should).

    I tried to add in a rewrite rule in the root .htaccess file to rewrite https://www.domain.com to https://secure.domain.com but it either led to a too many redirects error or simply did not change the URL that W3TC was using. I also emptied the W3TC caches and cleared the browser's cache with every change to make sure there was no issue with changes not propagating.

    That having been said, does anyone have any idea if this is a W3TC issue or a WordPress-HTTPS issue. Naturally, when I turn off W3TC everything loads as normal over the https secure subdomain, but with W3TC turned on the page appears unstyled because CSS doesn't load for the aforementioned reason. I'm not sure if this is an issue with W3TC using an absolute URL for some reason or if this is a bug with WordPress-HTTPS where it isn't rewriting a URL that it should be rewriting. Either way, regardless of where the problem stems from, I'm aiming for both of the W3TC cache files (CSS and JS) to load and to be linked as relative URLs over https (not just over insecure connections on the www. domain). Until I can accomplish this I have to compromise on way or the other by turning off W3TC (and not having as efficient of a site) or not using https connections (and not having as secure of a site).

    Any help would be appreciated. Thanks.

    http://wordpress.org/extend/plugins/w3-total-cache/
    http://wordpress.org/extend/plugins/wordpress-https/

  2. Mvied
    Member
    Posted 2 years ago #

    WordPress HTTPS uses output buffering to fix the majority of issues that can arise when using SSL with WordPress. I imagine W3TC is caching the output without output buffering processing it, so the URL's are incorrect.

    I could probably fix it, depending on how their code is written. I'll have to see.

  3. Sam
    Member
    Posted 2 years ago #

    For the time being I've just turned off minify in W3TC so that I can use https on the pages that I need to be secure (since security outweighs minification). Of course, it would be nice to be able to turn minify back on (since it substantially reduces the number of CSS and Javascript requests), but if you can't find a solution then I can certainly survive like this. Thanks for looking into this (and thanks for the fantastic plugin).

  4. Frederick Townes
    Member
    Plugin Author

    Posted 1 year ago #

    W3TC uses the home option in the WP database to make the minify urls and others. Using different domains for the same wp site/install is not supported for Disc Enhanced.
    You can try either disc basic or opcode cache and add the following code to functions.php in your theme to disable minify for the page.

    add_action('wp_head','nominify_on_ssl_page');
     function nominify_on_ssl_page() {
     if ($_SERVER['HTTPS'] == "on") {
      define('DONOTMINIFY', true);
     }
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic